using System.Text.Json;
using System.Text.Json.Serialization;

namespace PlotLine.Models;

public sealed class SceneIntelligenceScene
{
    public string? SchemaVersion { get; init; }
    public SceneIntelligenceSceneReference? SceneReference { get; init; }
    public SceneIntelligenceSummary? Summary { get; init; }
    public SceneIntelligenceScenePurpose? ScenePurpose { get; init; }
    public SceneIntelligencePointOfView? PointOfView { get; init; }
    public SceneIntelligenceSetting? Setting { get; init; }
    public List<SceneIntelligenceCharacter>? Characters { get; init; }
    public List<SceneIntelligenceCharacterAppearance>? CharacterAppearance { get; init; }
    public List<SceneIntelligenceLocation>? Locations { get; init; }
    public List<SceneIntelligenceAsset>? Assets { get; init; }
    public List<SceneIntelligenceRelationship>? Relationships { get; init; }
    public List<SceneIntelligenceKnowledgeChange>? KnowledgeChanges { get; init; }
    public List<SceneIntelligenceTimelineClue>? TimelineClues { get; init; }
    public List<SceneIntelligenceQuestionRaised>? QuestionsRaised { get; init; }
    public List<SceneIntelligenceQuestionAnswered>? QuestionsAnswered { get; init; }
    public List<SceneIntelligenceObservation>? Observations { get; init; }
    public Dictionary<string, SceneIntelligenceMetric>? Metrics { get; init; }
    public SceneIntelligenceSourceLimits? SourceLimits { get; init; }

    [JsonExtensionData]
    public Dictionary<string, JsonElement>? ExtensionData { get; init; }
}

public sealed class SceneIntelligenceSceneReference
{
    public int? ProjectId { get; init; }
    public int? BookId { get; init; }
    public int? ChapterId { get; init; }
    public int? SceneId { get; init; }
    public decimal? ChapterNumber { get; init; }
    public decimal? SceneNumber { get; init; }
    public string? SourceLabel { get; init; }

    [JsonExtensionData]
    public Dictionary<string, JsonElement>? ExtensionData { get; init; }
}

public sealed class SceneIntelligenceSummary
{
    public string? Short { get; init; }
    public string? Detailed { get; init; }
    public decimal? Confidence { get; init; }

    [JsonExtensionData]
    public Dictionary<string, JsonElement>? ExtensionData { get; init; }
}

public sealed class SceneIntelligenceScenePurpose
{
    public string? ObservedFunction { get; init; }
    public decimal? Confidence { get; init; }

    [JsonExtensionData]
    public Dictionary<string, JsonElement>? ExtensionData { get; init; }
}

public sealed class SceneIntelligencePointOfView
{
    public string? CharacterName { get; init; }
    public string? NarrativeMode { get; init; }
    public decimal? Confidence { get; init; }
    public string? Evidence { get; init; }

    [JsonExtensionData]
    public Dictionary<string, JsonElement>? ExtensionData { get; init; }
}

public sealed class SceneIntelligenceSetting
{
    public string? TimeOfDay { get; init; }
    public string? DateOrTimeReference { get; init; }
    public string? LocationName { get; init; }
    public string? LocationType { get; init; }
    public string? GenericRoomType { get; init; }
    public string? ParentLocationHint { get; init; }
    public decimal? Confidence { get; init; }

    [JsonExtensionData]
    public Dictionary<string, JsonElement>? ExtensionData { get; init; }
}

public sealed class SceneIntelligenceCharacter
{
    public string? Name { get; init; }
    public string? RoleInScene { get; init; }
    public bool? MentionedOnly { get; init; }
    public List<string>? Aliases { get; init; }
    public List<string>? Actions { get; init; }
    public decimal? Confidence { get; init; }
    public string? Notes { get; init; }

    [JsonExtensionData]
    public Dictionary<string, JsonElement>? ExtensionData { get; init; }
}

public sealed class SceneIntelligenceCharacterAppearance
{
    public string? CanonicalName { get; init; }
    public List<string>? Aliases { get; init; }
    public string? Title { get; init; }
    public string? Presentation { get; init; }
    public string? ExplicitAge { get; init; }
    public string? InferredAgeBand { get; init; }
    public string? HairColour { get; init; }
    public string? HairLength { get; init; }
    public string? HairStyle { get; init; }
    public string? FacialHair { get; init; }
    public string? Glasses { get; init; }
    public string? Build { get; init; }
    public List<string>? DistinctiveFeatures { get; init; }
    public string? Clothing { get; init; }
    public string? RoleOrOccupation { get; init; }
    public string? RelationshipAgeEvidence { get; init; }
    public string? PronounEvidence { get; init; }
    public string? Evidence { get; init; }
    public decimal? Confidence { get; init; }
    public string? EvidenceKind { get; init; }

    [JsonExtensionData]
    public Dictionary<string, JsonElement>? ExtensionData { get; init; }
}

public sealed class SceneIntelligenceLocation
{
    public string? Name { get; init; }
    public string? LocationType { get; init; }
    public string? GenericRoomType { get; init; }
    public string? ParentLocationHint { get; init; }
    public bool? PresentInScene { get; init; }
    public bool? MentionedOnly { get; init; }
    public decimal? Confidence { get; init; }
    public string? Notes { get; init; }

    [JsonExtensionData]
    public Dictionary<string, JsonElement>? ExtensionData { get; init; }
}

public sealed class SceneIntelligenceAsset
{
    public string? Name { get; init; }
    public string? AssetType { get; init; }
    public string? Status { get; init; }
    public string? OwnerOrHolder { get; init; }
    public bool? MentionedOnly { get; init; }
    public decimal? Confidence { get; init; }
    public string? Notes { get; init; }

    [JsonExtensionData]
    public Dictionary<string, JsonElement>? ExtensionData { get; init; }
}

public sealed class SceneIntelligenceRelationship
{
    public string? CharacterA { get; init; }
    public string? CharacterB { get; init; }
    public string? RelationshipSignal { get; init; }
    public string? Evidence { get; init; }
    public decimal? Confidence { get; init; }

    [JsonExtensionData]
    public Dictionary<string, JsonElement>? ExtensionData { get; init; }
}

public sealed class SceneIntelligenceKnowledgeChange
{
    public string? RecipientCharacter { get; init; }
    public string? KnowledgeItem { get; init; }
    public string? ChangeType { get; init; }
    public string? SourceCharacter { get; init; }
    public string? SourceType { get; init; }
    public string? Evidence { get; init; }
    public decimal? Confidence { get; init; }

    [JsonExtensionData]
    public Dictionary<string, JsonElement>? ExtensionData { get; init; }
}

public sealed class SceneIntelligenceTimelineClue
{
    public string? Clue { get; init; }
    public string? RelativeOrder { get; init; }
    public string? AbsoluteDate { get; init; }
    public string? Evidence { get; init; }
    public decimal? Confidence { get; init; }

    [JsonExtensionData]
    public Dictionary<string, JsonElement>? ExtensionData { get; init; }
}

public sealed class SceneIntelligenceQuestionRaised
{
    public string? Question { get; init; }
    public string? Scope { get; init; }
    public string? Evidence { get; init; }
    public decimal? Confidence { get; init; }

    [JsonExtensionData]
    public Dictionary<string, JsonElement>? ExtensionData { get; init; }
}

public sealed class SceneIntelligenceQuestionAnswered
{
    public string? Question { get; init; }
    public string? Answer { get; init; }
    public string? Evidence { get; init; }
    public decimal? Confidence { get; init; }

    [JsonExtensionData]
    public Dictionary<string, JsonElement>? ExtensionData { get; init; }
}

public sealed class SceneIntelligenceObservation
{
    public string? ObservationType { get; init; }
    public string? SubjectEntityType { get; init; }
    public string? SubjectName { get; init; }
    public string? ObjectEntityType { get; init; }
    public string? ObjectName { get; init; }
    public string? Predicate { get; init; }
    public string? Description { get; init; }
    public string? Evidence { get; init; }
    public decimal? Confidence { get; init; }

    [JsonExtensionData]
    public Dictionary<string, JsonElement>? ExtensionData { get; init; }
}

public sealed class SceneIntelligenceMetric
{
    public int? Score { get; init; }
    public decimal? Confidence { get; init; }

    [JsonExtensionData]
    public Dictionary<string, JsonElement>? ExtensionData { get; init; }
}

public sealed class SceneIntelligenceSourceLimits
{
    public bool? ContainsAmbiguity { get; init; }
    public List<string>? AmbiguityNotes { get; init; }

    [JsonExtensionData]
    public Dictionary<string, JsonElement>? ExtensionData { get; init; }
}
