using System.Text.Json.Serialization;

namespace QuantEngine.Core.Models;

/// <summary>
/// Price Source API 응답 결과 — Python _normalize_kis_fields() 반환값 대응
/// </summary>
public class PriceSourceResult
{
    [JsonPropertyName("status")]
    public string Status { get; set; } = "OK";

    [JsonPropertyName("error")]
    public string? Error { get; set; }

    [JsonPropertyName("source")]
    public string Source { get; set; } = "kis";

    [JsonPropertyName("account")]
    public string? Account { get; set; }

    // Price fields
    [JsonPropertyName("current_price")]
    public double? CurrentPrice { get; set; }

    [JsonPropertyName("open")]
    public double? Open { get; set; }

    [JsonPropertyName("high")]
    public double? High { get; set; }

    [JsonPropertyName("low")]
    public double? Low { get; set; }

    [JsonPropertyName("prev_close")]
    public double? PrevClose { get; set; }

    [JsonPropertyName("volume")]
    public double? Volume { get; set; }

    [JsonPropertyName("change_pct")]
    public double? ChangePct { get; set; }

    // Orderbook fields
    [JsonPropertyName("ask_1")]
    public double? Ask1 { get; set; }

    [JsonPropertyName("bid_1")]
    public double? Bid1 { get; set; }

    [JsonPropertyName("microstructure_pressure")]
    public double? MicrostructurePressure { get; set; }

    // Short sale
    [JsonPropertyName("short_turnover_share")]
    public double? ShortTurnoverShare { get; set; }

    // Status tracking
    [JsonPropertyName("price_status")]
    public string? PriceStatus { get; set; }

    [JsonPropertyName("orderbook_status")]
    public string? OrderbookStatus { get; set; }

    [JsonPropertyName("short_sale_status")]
    public string? ShortSaleStatus { get; set; }

    // Raw responses (for provenance)
    [JsonPropertyName("current_price_raw")]
    public Dictionary<string, object>? CurrentPriceRaw { get; set; }

    [JsonPropertyName("orderbook_raw")]
    public Dictionary<string, object>? OrderbookRaw { get; set; }

    [JsonPropertyName("short_sale_raw")]
    public Dictionary<string, object>? ShortSaleRaw { get; set; }
}
