using System.Text.Json.Serialization;
using NeonSprawl.Server.Game.PositionState;

namespace NeonSprawl.Server.Game.Interaction;

/// <summary>JSON body for <c>GET /game/world/interactables</c> (NEO-25).</summary>
public sealed class InteractablesListResponse
{
    public const int CurrentSchemaVersion = 1;

    [JsonPropertyName("schemaVersion")]
    public int SchemaVersion { get; init; } = CurrentSchemaVersion;

    /// <summary>Stable ascending <c>interactableId</c> order (ordinal).</summary>
    [JsonPropertyName("interactables")]
    public required IReadOnlyList<InteractableDescriptorJson> Interactables { get; init; }
}

/// <summary>One row in the prototype interactable projection.</summary>
public sealed class InteractableDescriptorJson
{
    [JsonPropertyName("interactableId")]
    public required string InteractableId { get; init; }

    /// <summary>Stable machine string for branching (e.g. <c>terminal</c>, <c>resource_node</c>).</summary>
    [JsonPropertyName("kind")]
    public required string Kind { get; init; }

    [JsonPropertyName("anchor")]
    public required PositionVector Anchor { get; init; }

    /// <summary>Horizontal reach on X/Z; inclusive boundary (same as NEO-9).</summary>
    [JsonPropertyName("interactionRadius")]
    public double InteractionRadius { get; init; }
}
