namespace Titano.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.
///
public sealed record IngestRequest(
Guid ArchiveId,
Guid? SequenceId,
string? NewSequenceTitle,
string? SessionKey,
string StagedPath,
string OriginalFileName,
long Size,
string Sha256,
DateTime? ClientCapturedAt,
Guid? UserId);
///
/// 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);
}