namespace AutoIngest.Engine
{
    /// <summary>
    /// A connected device as seen by an <see cref="IDeviceSource"/>. <see cref="Id"/> is the
    /// stable fingerprint persisted in the device registry; <see cref="Photos"/> is the live
    /// accessor for this connection.
    /// </summary>
    public class DeviceIdentity
    {
        /// <summary>
        /// Stable, source-specific fingerprint used as the registry key. Format conventions:
        ///  - SD/USB mass storage:  "MS:{volumeSerialHex}:{labelToUpper}" (volume serial from
        ///    GetVolumeInformationW, which survives reboots and drive-letter reassignment).
        ///  - MTP phone:            "MTP:{serialOrPnPId}:{nameToUpper}".
        ///  - Weak fallback (no serial available): "WEAK:{label}:{totalBytes}" — flagged so the
        ///    UI can warn that this id may collide across physically different devices.
        /// </summary>
        public string Id { get; init; } = "";

        /// <summary>Human-friendly name for prompts, logs, and the registry UI.</summary>
        public string DisplayName { get; init; } = "";

        /// <summary>"SD", "USB", "USB-weak", or "Phone". Drives icon/label in the UI.</summary>
        public string Kind { get; init; } = "";

        /// <summary>Live photo accessor for this connection. Valid only while connected.</summary>
        public IPhotoProvider Photos { get; init; } = null!;

        public override string ToString() => $"{Kind}:{DisplayName}";
    }
}
