using Theriapolis.Core.Util;

namespace Theriapolis.Core.World.Polylines;

public enum PolylineType : byte { River, Road, Rail }
public enum RiverClass   : byte { Stream, River, MajorRiver }
public enum RoadType     : byte { Footpath, DirtRoad, PostRoad, Highway }

/// <summary>
/// A polyline in world-pixel space (0..32768 on each axis).
/// Source of truth for rivers, roads, and rail. Per-tile flags on WorldTile are derived caches.
/// </summary>
public sealed class Polyline
{
    public PolylineType  Type                 { get; init; }
    public int           Id                   { get; init; }
    public List<Vec2>    Points               { get; } = new();
    public List<Vec2>?   SimplifiedPoints     { get; set; }
    public float         Width                { get; set; }

    // River-specific
    public RiverClass    RiverClassification  { get; set; }
    public int           FlowAccumulation     { get; set; }

    // Road-specific
    public RoadType      RoadClassification   { get; set; }

    // Infrastructure-specific (source/destination settlement IDs)
    public int           FromSettlementId     { get; set; } = -1;
    public int           ToSettlementId       { get; set; } = -1;

    public bool IsEmpty => Points.Count < 2;
}
