using System.Text.Json.Serialization;

namespace QuantEngine.Core.Models;

/// <summary>
/// 종목별 수집 데이터 스냅샷 — Python kis_data_collection_v1.py _collect_one() 반환값 대응
/// </summary>
public class CollectionSnapshot
{
    /// <summary>종목 코드 (6자리 숫자)</summary>
    [JsonPropertyName("ticker")]
    public string Ticker { get; set; } = string.Empty;

    /// <summary>종목명</summary>
    [JsonPropertyName("name")]
    public string? Name { get; set; }

    /// <summary>업종</summary>
    [JsonPropertyName("sector")]
    public string? Sector { get; set; }

    /// <summary>현재가</summary>
    [JsonPropertyName("current_price")]
    public double? CurrentPrice { get; set; }

    /// <summary>시가</summary>
    [JsonPropertyName("open")]
    public double? Open { get; set; }

    /// <summary>고가</summary>
    [JsonPropertyName("high")]
    public double? High { get; set; }

    /// <summary>저가</summary>
    [JsonPropertyName("low")]
    public double? Low { get; set; }

    /// <summary>이전 종가</summary>
    [JsonPropertyName("prev_close")]
    public double? PrevClose { get; set; }

    /// <summary>거래량</summary>
    [JsonPropertyName("volume")]
    public double? Volume { get; set; }

    /// <summary>등락률 (%)</summary>
    [JsonPropertyName("change_pct")]
    public double? ChangePct { get; set; }

    /// <summary>매도호가</summary>
    [JsonPropertyName("ask_1")]
    public double? Ask1 { get; set; }

    /// <summary>매수호가</summary>
    [JsonPropertyName("bid_1")]
    public double? Bid1 { get; set; }

    /// <summary>장중 강도 (주문량 불균형)</summary>
    [JsonPropertyName("microstructure_pressure")]
    public double? MicrostructurePressure { get; set; }

    /// <summary>공매도 주식 수</summary>
    [JsonPropertyName("short_turnover_share")]
    public double? ShortTurnoverShare { get; set; }

    /// <summary>가격 조회 상태 (OK, ERROR)</summary>
    [JsonPropertyName("price_status")]
    public string PriceStatus { get; set; } = "OK";

    /// <summary>호가 조회 상태 (OK, ERROR)</summary>
    [JsonPropertyName("orderbook_status")]
    public string OrderbookStatus { get; set; } = "OK";

    /// <summary>공매도 조회 상태 (OK, ERROR)</summary>
    [JsonPropertyName("short_sale_status")]
    public string ShortSaleStatus { get; set; } = "OK";

    /// <summary>수집 시각 (ISO 8601 KST)</summary>
    [JsonPropertyName("collection_as_of")]
    public string? CollectionAsOf { get; set; }

    /// <summary>가격 조회 에러 메시지</summary>
    [JsonPropertyName("price_error")]
    public string? PriceError { get; set; }

    /// <summary>호가 조회 에러 메시지</summary>
    [JsonPropertyName("orderbook_error")]
    public string? OrderbookError { get; set; }

    /// <summary>공매도 조회 에러 메시지</summary>
    [JsonPropertyName("short_sale_error")]
    public string? ShortSaleError { get; set; }

    /// <summary>상대 수익률 (20일)</summary>
    [JsonPropertyName("relative_return_20d")]
    public double? RelativeReturn20D { get; set; }

    /// <summary>거래량 비율 (5일)</summary>
    [JsonPropertyName("volume_ratio_5d")]
    public double? VolumeRatio5D { get; set; }

    /// <summary>수집 날짜 (기초 데이터)</summary>
    [JsonPropertyName("Price_Date")]
    public string? PriceDate { get; set; }
}
