From 6dd1de894cb33b3fb5a586ad8fb5c108aecac4ca Mon Sep 17 00:00:00 2001 From: KoalaTrapLord Date: Wed, 18 Mar 2026 02:01:35 -0400 Subject: [PATCH] Unity U3: Add DeckGenResponse.cs + GeneratedDeckCard (#48) This file defines the DeckGenResponse class and its associated GeneratedDeckCard class, which map to the response structure from the /api/deckgen/v3 endpoint. --- .../Assets/Scripts/Models/DeckGenResponse.cs | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 unity-client/Assets/Scripts/Models/DeckGenResponse.cs diff --git a/unity-client/Assets/Scripts/Models/DeckGenResponse.cs b/unity-client/Assets/Scripts/Models/DeckGenResponse.cs new file mode 100644 index 0000000..ecafe18 --- /dev/null +++ b/unity-client/Assets/Scripts/Models/DeckGenResponse.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using Newtonsoft.Json; + +namespace CommanderAILab.Models +{ + /// Maps to GeneratedDeckCard from /api/deckgen/v3. + [Serializable] + public class GeneratedDeckCard + { + [JsonProperty("scryfall_id")] public string scryfallId; + [JsonProperty("name")] public string name; + [JsonProperty("type_line")] public string typeLine; + [JsonProperty("mana_cost")] public string manaCost; + [JsonProperty("cmc")] public float cmc; + [JsonProperty("card_type")] public string cardType; + [JsonProperty("roles")] public List roles; + [JsonProperty("source")] public string source; + [JsonProperty("quantity")] public int quantity; + [JsonProperty("image_url")] public string imageUrl; + [JsonProperty("owned_qty")] public int ownedQty; + [JsonProperty("is_proxy")] public bool isProxy; + + public override string ToString() => $"{name} ({manaCost})"; + } + + /// Response wrapper for /api/deckgen/v3. + [Serializable] + public class DeckGenResponse + { + [JsonProperty("cards")] public List cards; + [JsonProperty("commander")] public string commander; + [JsonProperty("strategy")] public string strategy; + + public override string ToString() => $"Generated deck: {commander} ({cards?.Count ?? 0} cards)"; + } +}