using System.Text.Json.Serialization;

namespace Theriapolis.Core.Data;

/// <summary>
/// Immutable species (subrace-equivalent) record loaded from species.json.
/// Refines the parent <see cref="CladeDef"/>: adds a body size, additional
/// ability mods, species-specific traits, and species-specific detriments.
/// </summary>
public sealed record SpeciesDef
{
    [JsonPropertyName("id")]
    public string Id { get; init; } = "";

    [JsonPropertyName("clade_id")]
    public string CladeId { get; init; } = "";

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

    /// <summary>Body size category, snake_case (small / medium / medium_large / large).</summary>
    [JsonPropertyName("size")]
    public string Size { get; init; } = "medium";

    /// <summary>Additional ability mods on top of the clade's mods.</summary>
    [JsonPropertyName("ability_mods")]
    public Dictionary<string, int> AbilityMods { get; init; } = new();

    /// <summary>Base movement speed in feet per turn (5 ft. = 1 tactical tile per d20 standard).</summary>
    [JsonPropertyName("base_speed_ft")]
    public int BaseSpeedFt { get; init; } = 30;

    [JsonPropertyName("traits")]
    public TraitDef[] Traits { get; init; } = Array.Empty<TraitDef>();

    [JsonPropertyName("detriments")]
    public TraitDef[] Detriments { get; init; } = Array.Empty<TraitDef>();
}
