namespace Chronos.Protocol; // The videos library (owner review 1, R9): every render of the server in one list, on servers with the "videos" capability // (ServerCapabilities.Videos). Read lists and plays, Delete moves renders into the archive's trash (restored through // /archive/trash), Edit copies them into the server's videos folder; the panel and the desktop's Videos section use these. /// A verified copy of a video in a videos folder (). /// Absolute path of the copy on the host that made it. public sealed record VideoCopyDto(string Path, DateTimeOffset CopiedAt); /// /// GET /api/v1/videos, GET /api/v1/videos/{id}: a render with the members of , its /// sequence and project, whether its file is there, and its copies. The file itself is GET /api/v1/renders/{id}/file /// (Range requests served, so a browser's <video> seeks). /// /// The library kind, never null: video, still or sequence (an image-sequence folder), /// or a newer server's kind as it is ( holds the kind as recorded). /// The display title of the render's sequence. /// When its first photo was taken; null when unknown. /// The project rendered (owner review 2, R8); null for a render of the sequence's settings. /// The number of the project version rendered; null with . /// ok, or missing when its file is not where it was recorded (delete then removes only the entry). /// The file (or folder) name, for display and downloads. public sealed record VideoDto( Guid Id, Guid SequenceId, string PresetName, string? Codec, int Width, int Height, double Fps, double DurationSeconds, long Bytes, DateTimeOffset Created, string? ProducedBy, Guid? ProjectId, Guid? ProjectVersionId, string? Sha256, string Kind, string SequenceTitle, DateTime? SequenceFirstCapture, string? ProjectName, int? ProjectVersionNumber, string State, IReadOnlyList Copies, string? FileName = null); /// The values of . public static class VideoStates { public const string Ok = "ok"; /// The render's file is not where it was recorded. public const string Missing = "missing"; } /// The sort values of GET /api/v1/videos (and of the desktop's Videos section). public static class VideoSorts { /// Newest first (the default). public const string Newest = "newest"; public const string Oldest = "oldest"; /// Largest first. public const string Largest = "largest"; /// By sequence title, then newest first. public const string Title = "title"; public static IReadOnlyList All { get; } = [Newest, Oldest, Largest, Title]; } /// One page of GET /api/v1/videos; is the cursor of the next page, null on the last one. /// Videos matching the filters on every page; null when the server does not count them. public sealed record VideoPageDto(IReadOnlyList Items, string? Next, long? Total = null); /// /// The query of GET /api/v1/videos (); every member optional. /// /// Text in the sequence title, the preset name or the file name. /// video, still or sequence. /// A codec name as recorded (h264, hevc, pngsequence…). /// The year the render was made (UTC). /// The videos of one sequence. /// One of ; null for newest first. /// The of the previous page. /// Videos per page, 1–500 (the server's default when null). public sealed record VideoQueryDto(string? Q = null, string? Kind = null, string? Codec = null, int? Year = null, Guid? Sequence = null, string? Sort = null, string? Cursor = null, int? Limit = null); /// /// POST /api/v1/videos/delete: move these renders into the archive's trash. With the server /// answers the plan () and moves nothing; the delete itself must send the plan's /// back, or the server answers 409 plan_changed and moves nothing. /// public sealed record VideoDeleteRequest(IReadOnlyList Ids, bool DryRun, string? Fingerprint = null); /// A render of a delete plan: what goes, and whether only its entry goes (its file is missing). public sealed record VideoDeleteItemDto(Guid Id, Guid SequenceId, string SequenceTitle, string? FileName, long Bytes, bool Missing); /// /// A render a delete leaves where it is: busy (a send, an upload or a copy of it is running) or /// not_found (no such render). /// public sealed record VideoBlockedDto(Guid Id, string Reason); /// The values of . public static class VideoBlockReasons { public const string Busy = "busy"; public const string NotFound = "not_found"; } /// /// The answer of POST /api/v1/videos/delete: the renders that go (or went) to the trash, their bytes, the renders left /// where they are, and the plan's fingerprint. Copies in the videos folder are never touched. After the delete itself /// ( false) names the trash entries made, each restorable with /// POST /api/v1/archive/trash/{name}/restore. /// public sealed record VideoDeletePlanDto(IReadOnlyList Items, long Bytes, IReadOnlyList Blocked, string Fingerprint, bool DryRun, IReadOnlyList? TrashEntries = null); /// /// POST /api/v1/videos/copy: copy these renders into the server's videos folder as one video-copy job; 409 /// videos_folder_unset when the server has none. /// public sealed record VideoCopyRequest(IReadOnlyList Ids); /// The answer of POST /api/v1/videos/copy (202): the video-copy job queued. public sealed record VideoCopyResultDto(Guid JobId);