package com.market.model.binance;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * 币安现货 K 线流消息
 *
 * @author system
 * @date 2026-05-07
 */
public class SpotKlineMessage extends SpotStreamMessage {

    /** K线数据 */
    @JsonProperty("k")
    private Kline kline;

    public Kline getKline() { return kline; }
    public void setKline(Kline kline) { this.kline = kline; }

    /**
     * K线详情
     */
    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class Kline {
        /** 开始时间 */
        @JsonProperty("t") private Long startTime;
        /** 结束时间 */
        @JsonProperty("T") private Long endTime;
        /** 交易对 */
        @JsonProperty("s") private String symbol;
        /** K线周期（1m/3m/5m...） */
        @JsonProperty("i") private String interval;
        /** 开盘价 */
        @JsonProperty("o") private String open;
        /** 收盘价 */
        @JsonProperty("c") private String close;
        /** 最高价 */
        @JsonProperty("h") private String high;
        /** 最低价 */
        @JsonProperty("l") private String low;
        /** 成交量 */
        @JsonProperty("v") private String volume;
        /** 成交额（计价货币） */
        @JsonProperty("q") private String quoteAssetVolume;
        /** 是否已关闭 */
        @JsonProperty("x") private Boolean isClosed;

        public Long getStartTime() { return startTime; }
        public void setStartTime(Long startTime) { this.startTime = startTime; }
        public Long getEndTime() { return endTime; }
        public void setEndTime(Long endTime) { this.endTime = endTime; }
        public String getSymbol() { return symbol; }
        public void setSymbol(String symbol) { this.symbol = symbol; }
        public String getInterval() { return interval; }
        public void setInterval(String interval) { this.interval = interval; }
        public String getOpen() { return open; }
        public void setOpen(String open) { this.open = open; }
        public String getClose() { return close; }
        public void setClose(String close) { this.close = close; }
        public String getHigh() { return high; }
        public void setHigh(String high) { this.high = high; }
        public String getLow() { return low; }
        public void setLow(String low) { this.low = low; }
        public String getVolume() { return volume; }
        public void setVolume(String volume) { this.volume = volume; }
        public String getQuoteAssetVolume() { return quoteAssetVolume; }
        public void setQuoteAssetVolume(String v) { this.quoteAssetVolume = v; }
        public Boolean getIsClosed() { return isClosed; }
        public void setIsClosed(Boolean isClosed) { this.isClosed = isClosed; }
    }
}
