namespace Chronos.Protocol; /// /// POST /api/v1/uploads (BRIEF §14.4). The client hashes the file first; when the server already holds that /// SHA-256 it answers 200 with and no upload is needed. A photo deleted /// from the target sequence is answered the same way, without a frame (owner review 2, R6), unless /// asks to file it there again: only an explicit user action sends it (the admin panel's "Upload again"), never sync or a /// watch folder, and the completion repeats it (complete?restore=true). Filing it drops the photo's tombstone. /// /// (owner review 6, #73; capability ) files the photo into /// even when another sequence of the served archive holds it: the server copies its own file into /// the target, no bytes on the wire, and answers . The caller must own the target, /// be an admin or hold the Edit right; never with . /// /// public sealed record StartUploadRequest(Guid? SequenceId, string FileName, long Size, string Sha256, DateTime? CapturedAt, string? SessionKey, bool Restore = false, bool IntoTarget = false); /// /// The answer to POST /api/v1/uploads. : the server filed the photo into the target from a file it /// held in another sequence (); is the new frame. /// public sealed record StartUploadResponse(Guid? UploadId, int ChunkSize, IReadOnlyList Received, bool AlreadyExists, Guid? FrameId, bool Copied = false); /// Error codes of the frame upload calls that clients act on. public static class UploadErrors { /// /// 409 from POST /api/v1/uploads/{id}/complete: the photo was deleted from the target sequence while it was on its /// way and the completion did not ask to restore it, so it was not filed and the upload is cancelled (owner review 2, R6). /// public const string PhotoRemoved = "photo_removed"; } /// PUT /api/v1/uploads/{id}/chunks/{n} response. public sealed record ChunkReceived(int Index, IReadOnlyList Received); /// POST /api/v1/uploads/{id}/complete response: the committed frame. public sealed record CompleteUploadResponse(Guid FrameId, Guid SequenceId, int Index); /// GET /api/v1/uploads/{id}: resume state. public sealed record UploadState(Guid UploadId, string FileName, long Size, string Sha256, int ChunkSize, IReadOnlyList Received, string State); /// /// POST /api/v1/uploads/cards: a client importing a card into the server through these uploads reports its start, /// progress and end (BRIEF §14.4); the server tells every connected client with a (BRIEF §14.3). /// is the client's import plan, the card's name as the client shows it. /// public sealed record CardImportReport(Guid ImportId, string Card, string State, int Done, int Total, int Failed); /// /// POST /api/v1/sequences/{id}/renders: a client offers one of its renders of the sequence (BRIEF §14.5, /// renders are uploaded on request). The render keeps its id on the server, so both sides recognise it; when the /// server already has that id it answers 200 with . Chunks go to /// /uploads/{uploadId}/chunks/{n}; POST /sequences/{id}/renders/{uploadId}/complete verifies the SHA-256 /// and files the render under the sequence's exports. A completion that cannot file it for now answers 503 /// sequence_busy, archive_offline or folder_moved (another index moved the sequence's folder; the /// server's next scan finds it) and keeps the upload, to be completed again. /// A render a workspace made on a client (phase 5c) names the project and version it was rendered from /// (, ): the server records them with the render once it checked that /// the project is the sequence's and the version the project's (422 project_mismatch otherwise). Both are optional /// and appended: a request of an earlier client has neither, and an earlier server ignores them. (owner /// review 1, R9) is the render's kind (still, or null for a video or an image sequence), appended the same way. /// public sealed record RenderUploadRequest( Guid RenderId, string FileName, long Size, string Sha256, string PresetName, string? Codec, int Width, int Height, double Fps, double DurationSeconds, string? ProducedBy, Guid? ProjectId = null, Guid? ProjectVersionId = null, string? Kind = null);