using Titano.Core.Imaging;
using Titano.Core.Model;
namespace Titano.Core.Metadata;
public enum PreviewKind
{
Thumbnail,
Preview,
FullSize,
}
/// An embedded JPEG inside a RAW/TIFF/HEIF/JPEG(MPF) container.
public sealed record EmbeddedPreview(long Offset, long Length, int Width, int Height, PreviewKind Kind);
public sealed record GpsPosition(double Latitude, double Longitude, double? Altitude, DateTime? UtcTimestamp);
/// Everything Titano reads from one photo's metadata (BRIEF §9). Never throws while parsing:
/// malformed input yields partial data plus .
public sealed record FrameMetadata
{
public ImageFileFormat Format { get; init; }
public string? Make { get; init; }
public string? Model { get; init; }
public string? BodySerial { get; init; }
public string? LensModel { get; init; }
public string? Software { get; init; }
public string? Artist { get; init; }
public string? Copyright { get; init; }
/// Camera wall-clock time including sub-seconds (DateTimeKind.Unspecified).
public DateTime? CapturedAt { get; init; }
public int? UtcOffsetMinutes { get; init; }
public TimestampSource TimestampSource { get; init; }
public double? ExposureTime { get; init; }
public double? FNumber { get; init; }
public int? Iso { get; init; }
public double? FocalLength { get; init; }
public double? FocalLength35 { get; init; }
public double? ExposureBias { get; init; }
public int? ExposureProgram { get; init; }
public int? MeteringMode { get; init; }
public int? WhiteBalanceMode { get; init; }
public int? ColorTemperature { get; init; }
public int? Flash { get; init; }
/// Exif orientation 1–8.
public int Orientation { get; init; } = 1;
/// Dimensions of the main (largest) image as stored, before orientation.
public int Width { get; init; }
public int Height { get; init; }
public int? BitsPerSample { get; init; }
public GpsPosition? Gps { get; init; }
public int? Rating { get; init; }
public string? Label { get; init; }
public long? ShutterCount { get; init; }
public bool? ImageStabilization { get; init; }
/// Embedded JPEGs, largest first.
public IReadOnlyList Previews { get; init; } = [];
public IReadOnlyList Warnings { get; init; } = [];
/// Width/height after applying orientation 5–8 (90° rotations).
public (int Width, int Height) OrientedSize => Orientation is >= 5 and <= 8 ? (Height, Width) : (Width, Height);
public EmbeddedPreview? LargestPreview => Previews.Count > 0 ? Previews[0] : null;
}