namespace PlotLine.Models;

public sealed class StoryIntelligenceCharacterIllustrationAssignment
{
    public int StoryIntelligenceCharacterIllustrationAssignmentID { get; init; }
    public int ProjectID { get; init; }
    public string CharacterKey { get; init; } = string.Empty;
    public string CharacterName { get; init; } = string.Empty;
    public int? IllustrationLibraryItemID { get; init; }
    public string? StableCode { get; init; }
    public decimal MatchConfidence { get; init; }
    public int MatchingScore { get; init; }
    public string? EvidenceJson { get; init; }
    public string? CandidateDiagnosticsJson { get; init; }
    public string? ReasonChosen { get; init; }
    public string? ReasonReassigned { get; init; }
    public int? ImportSessionID { get; init; }
    public string AssignmentStatus { get; init; } = "Assigned";
    public DateTime? AssignedUtc { get; init; }
    public DateTime? LastValidatedUtc { get; init; }
    public DateTime? InvalidatedUtc { get; init; }
    public string? InvalidationReason { get; init; }
    public string EvidenceVersion { get; init; } = "21K";
    public bool IsFallback { get; init; }
    public bool IsActive { get; init; }
    public DateTime CreatedUtc { get; init; }
    public DateTime UpdatedUtc { get; init; }
}

public sealed record StoryIntelligenceCharacterIllustrationAssignmentSave(
    int ProjectID,
    string CharacterKey,
    string CharacterName,
    int? IllustrationLibraryItemID,
    string? StableCode,
    decimal MatchConfidence,
    int MatchingScore,
    string? EvidenceJson,
    string? CandidateDiagnosticsJson,
    string? ReasonChosen,
    string? ReasonReassigned);

public sealed class StoryIntelligenceIllustrationDemand
{
    public int StoryIntelligenceIllustrationDemandID { get; init; }
    public int? ProjectID { get; init; }
    public string DemandKey { get; init; } = string.Empty;
    public string AgeBand { get; init; } = string.Empty;
    public string Presentation { get; init; } = string.Empty;
    public string HairColour { get; init; } = string.Empty;
    public string SkinTone { get; init; } = string.Empty;
    public string? HairLength { get; init; }
    public string? Glasses { get; init; }
    public string? FacialHair { get; init; }
    public int RequestCount { get; init; }
    public DateTime LastRequestedUtc { get; init; }
    public DateTime? QueuedUtc { get; init; }
    public string GenerationSource { get; init; } = "Demand generation";
}

public sealed record StoryIntelligenceIllustrationDemandRequest(
    int? ProjectID,
    string DemandKey,
    string AgeBand,
    string Presentation,
    string HairColour,
    string SkinTone,
    string? HairLength,
    string? Glasses,
    string? FacialHair);
