using System.Text.Json.Serialization;

namespace Theriapolis.Core.Data;

/// <summary>
/// Phase 6 M1 — pre-meeting prejudice template per
/// <c>theriapolis-rpg-reputation.md §I-1</c>. Each NPC carries a
/// <c>BiasProfileId</c> that points at one of these; the runtime
/// disposition formula adds <see cref="CladeBias"/>[pc.clade] (plus the
/// universal size-differential modifier) to the personal/faction
/// components when computing how an NPC reacts to the player.
///
/// 12 profiles ship with the game: pack-loyal Canid traditionalists,
/// herd-cautious Cervids, urban progressives, hybrid survivors, etc.
/// Adding new profiles is a content-only edit.
/// </summary>
public sealed record BiasProfileDef
{
    [JsonPropertyName("id")]
    public string Id { get; init; } = "";

    [JsonPropertyName("name")]
    public string Name { get; init; } = "";

    [JsonPropertyName("description")]
    public string Description { get; init; } = "";

    /// <summary>Modifier for the player's clade. Keys are clade ids ("canidae", "felidae", ...).</summary>
    [JsonPropertyName("clade_bias")]
    public Dictionary<string, int> CladeBias { get; init; } = new();

    /// <summary>Modifier when the player is detected as hybrid. Negative = stigma, positive = solidarity.</summary>
    [JsonPropertyName("hybrid_bias")]
    public int HybridBias { get; init; } = 0;

    /// <summary>
    /// Optional faction-affinity hints. Map of faction id → +integer (faction
    /// the NPC favours) or -integer (faction the NPC distrusts). Phase 6 M5
    /// uses these to decide how an NPC reacts to the player's faction
    /// standing; M1/M2 only display them in the disposition tooltip.
    /// </summary>
    [JsonPropertyName("faction_affinity")]
    public Dictionary<string, int> FactionAffinity { get; init; } = new();
}
