namespace splat;

using Godot;

/// <summary>
/// Physical description of a ground type. Drives foundation behaviour: how fast
/// a structure sinks (settling) and how susceptible the ground is to frost heave.
/// Values are illustrative soil-mechanics estimates for Scottish Highlands terrain.
/// </summary>
[GlobalClass]
public partial class GroundType : Resource
{
    public enum Kind
    {
        Rock,
        Clay,
        Soil,
        PeatBog
    }

    [Export] public string GroundName { get; set; } = "Soil";
    [Export] public Kind Type { get; set; } = Kind.Soil;

    /// <summary>Settling rate (m/day) a foundation sinks into this ground.</summary>
    [Export] public float SettlementRate { get; set; } = 0.01f;

    /// <Export>Dry friction coefficient for vehicles/structures on the surface.</Export>
    [Export] public float Friction { get; set; } = 0.8f;

    /// <summary>[0,1] how readily frost heave lifts foundations (1 = worst).</summary>
    [Export(PropertyHint.Range, "0,1,0.01")]
    public float FrostSusceptibility { get; set; } = 0.3f;

    /// <summary>[0,1] drainage quality; lower means more saturation/subsidence.</summary>
    [Export(PropertyHint.Range, "0,1,0.01")]
    public float Drainage { get; set; } = 0.5f;

    public static GroundType Default()
    {
        var g = new GroundType();
        g.ResourceName = "Soil";
        return g;
    }
}
