using System.Text.Json.Serialization; namespace NeonSprawl.Server.Game.Interaction; /// JSON body for every handled interaction attempt (HTTP 200 only; NS-18). /// /// When is false, is required and must be non-empty. /// When is true, omit ; is optional. /// Unknown player → HTTP 404 (no body). Malformed v1 request → HTTP 400. /// public sealed class InteractionResponse { public const int CurrentSchemaVersion = 1; [JsonPropertyName("schemaVersion")] public int SchemaVersion { get; init; } = CurrentSchemaVersion; [JsonPropertyName("allowed")] public bool Allowed { get; init; } /// Stable machine string when denied; omitted when allowed. [JsonPropertyName("reasonCode")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public string? ReasonCode { get; init; } /// Echo canonical id on success; omitted when denied. [JsonPropertyName("interactableId")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public string? InteractableId { get; init; } [JsonPropertyName("payload")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public InteractionPlaceholderPayload? Payload { get; init; } } /// Placeholder success payload for prototype wiring. public sealed class InteractionPlaceholderPayload { [JsonPropertyName("kind")] public string Kind { get; init; } = "placeholder"; }