namespace Chronos.Protocol; /// /// One local sequence's sample for POST /api/v1/photos/lookup (owner review 6, #73): up to 64 SHA-256 (lower-case /// hex), up to 64 unhashed photos, and its back-reference key. /// public sealed record PhotoProbe(string Key, IReadOnlyList Sha256, IReadOnlyList? Unhashed = null, string? SessionKey = null); /// An unhashed photo, told apart by size and capture time to the millisecond. public sealed record PhotoKeyDto(long Size, DateTime CapturedAt); /// At most 200 probes and 20,000 items (hashes + unhashed keys + session keys) in all; 413 too_many beyond. public sealed record PhotoLookupRequest(IReadOnlyList Probes) { /// The most probes one request may carry. public const int MaxProbes = 200; /// The most items (hashes, unhashed keys and session keys) one request may carry. public const int MaxItems = 20_000; /// The items the request carries, as the limit counts them. public int CountItems() => Probes.Sum(p => (p.Sha256?.Count ?? 0) + (p.Unhashed?.Count ?? 0) + (p.SessionKey is null ? 0 : 1)); } /// The answer of a lookup: one result per probe, in the request's order. public sealed record PhotoLookupResponse(IReadOnlyList Results); /// The server sequences a probe hit. public sealed record ProbeResult(string Key, IReadOnlyList Hits); /// /// Hashes: distinct probe hashes the sequence holds in a frame; Removed: distinct probe hashes it tombstoned (deleted, or /// replaced by a conversion); Unhashed: probe keys a frame of it matches by size and capture time to the millisecond; /// SessionKey: the sequence is filed under the probe's session key. /// public sealed record PhotoLookupHit(Guid SequenceId, int Hashes, int Removed, int Unhashed, bool SessionKey);