namespace Chronos.Data.Archiving; /// /// A verified file waiting in a staging folder on the archive volume, ready to become a frame (BRIEF §4.3, §14.4). /// Exactly one of , or selects the target: /// an existing sequence, a new one with that title, or the sequence grouped automatically by session. /// /// Content the target sequence tombstoned (a photo deleted from it, none of its frames holding /// that content) is refused with , checked under the sequence's lease with the commit, so /// no deletion lands in between: an upload that does not ask to bring the photo back. Otherwise filing it drops the /// tombstone (a card imported again, a sync download, an explicit upload again). public sealed record IngestRequest( Guid ArchiveId, Guid? SequenceId, string? NewSequenceTitle, string? SessionKey, string StagedPath, string OriginalFileName, long Size, string Sha256, DateTime? ClientCapturedAt, Guid? UserId, bool RefuseRemoved = false); /// /// The target sequence tombstoned the content of an that refuses it /// (): the photo was deleted from it. Nothing was filed; the staged file stays. /// public sealed class PhotoRemovedException(Guid sequenceId, string sha256) : InvalidOperationException($"Sequence {sequenceId} tombstoned {sha256}: the photo was deleted from it and is not filed again.") { public Guid SequenceId { get; } = sequenceId; } /// /// The committed frame; when an intact frame of the sequence already held that SHA-256 (the file /// stays in staging). A frame with that SHA-256 that was missing or damaged is repaired with the file instead: /// , not a duplicate, and the archive holds no more bytes than before. /// public sealed record IngestResult(Guid SequenceId, Guid FrameId, int Index, string RelativePath, bool Duplicate, bool Repaired = false); /// /// Commits staged files into the archive layout (originals folder, naming templates, sequence.json written /// atomically) and the index. Used by the server's upload completion and by the client's card import. /// public interface IArchiveIngest { Task CommitAsync(IngestRequest request, CancellationToken cancellationToken = default); }