Files
commander-ai-lab/unity-client/Assets/Scripts/Models/DeckGenResponse.cs
T
KoalaTrapLord 6dd1de894c 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.
2026-03-18 02:01:35 -04:00

38 lines
1.4 KiB
C#

using System;
using System.Collections.Generic;
using Newtonsoft.Json;
namespace CommanderAILab.Models
{
/// <summary>Maps to GeneratedDeckCard from /api/deckgen/v3.</summary>
[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<string> 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})";
}
/// <summary>Response wrapper for /api/deckgen/v3.</summary>
[Serializable]
public class DeckGenResponse
{
[JsonProperty("cards")] public List<GeneratedDeckCard> cards;
[JsonProperty("commander")] public string commander;
[JsonProperty("strategy")] public string strategy;
public override string ToString() => $"Generated deck: {commander} ({cards?.Count ?? 0} cards)";
}
}