using System;
using System.Collections.Generic;
using API.Constants;
using API.Entities.Progress;
namespace API.Entities.User;
#nullable enable
public class ClientDevice
{
public int Id { get; set; }
///
/// Client-provided device identifier (from header)
/// Null for clients that don't send it (OPDS readers, etc.)
///
public string? UiFingerprint { get; set; }
///
/// Server-computed fingerprint for device matching
/// Hash of: ClientType + Platform + DeviceType + (Browser+BrowserVersion for web-app)
///
public string DeviceFingerprint { get; set; } = string.Empty;
///
/// User-friendly name, defaults to generated name like "Chrome on Windows"
///
/// Generated on first seen, user can customize after the fact
public string FriendlyName { get; set; } = string.Empty;
///
/// Most recent stable ClientInfoData (excluding IP/timestamp changes)
///
/// JSON Column
public ClientInfoData CurrentClientInfo { get; set; } = new();
public DateTime FirstSeenUtc { get; set; }
public DateTime LastSeenUtc { get; set; }
///
/// Soft delete - removed devices stay in DB for history
///
public bool IsActive { get; set; } = true;
// TODO: Put an optional string? for AppUserAuthKey used (it might change, so it should be last seen)
// Navigation properties
public int AppUserId { get; set; }
public virtual AppUser AppUser { get; set; } = null!;
public ICollection History { get; set; } = [];
}