package com.dexorder.flink.publisher;

import java.io.Serializable;

/**
 * Flink-serializable wrapper for a single Tick.
 * Fields mirror the Tick protobuf, using primitives to avoid proto-class serialization issues.
 */
public class TickWrapper implements Serializable {
    private static final long serialVersionUID = 1L;

    private String ticker;
    private String tradeId;
    /** Timestamp in nanoseconds since epoch */
    private long timestamp;
    /** Price as scaled integer */
    private long price;
    /** Base amount as scaled integer */
    private long amount;
    /** Quote amount as scaled integer */
    private long quoteAmount;
    private boolean takerBuy;

    public TickWrapper() {}

    public TickWrapper(String ticker, String tradeId, long timestamp,
                       long price, long amount, long quoteAmount, boolean takerBuy) {
        this.ticker = ticker;
        this.tradeId = tradeId;
        this.timestamp = timestamp;
        this.price = price;
        this.amount = amount;
        this.quoteAmount = quoteAmount;
        this.takerBuy = takerBuy;
    }

    public String getTicker() { return ticker; }
    public String getTradeId() { return tradeId; }
    public long getTimestamp() { return timestamp; }
    public long getPrice() { return price; }
    public long getAmount() { return amount; }
    public long getQuoteAmount() { return quoteAmount; }
    public boolean isTakerBuy() { return takerBuy; }

    public void setTicker(String ticker) { this.ticker = ticker; }
    public void setTradeId(String tradeId) { this.tradeId = tradeId; }
    public void setTimestamp(long timestamp) { this.timestamp = timestamp; }
    public void setPrice(long price) { this.price = price; }
    public void setAmount(long amount) { this.amount = amount; }
    public void setQuoteAmount(long quoteAmount) { this.quoteAmount = quoteAmount; }
    public void setTakerBuy(boolean takerBuy) { this.takerBuy = takerBuy; }

    @Override
    public String toString() {
        return "TickWrapper{ticker='" + ticker + "', tradeId='" + tradeId +
                "', timestamp=" + timestamp + ", price=" + price + '}';
    }
}
