package com.ruoyi.web.modules.trading;

import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
import com.ruoyi.web.modules.circulation.domain.BizTradeMarket;
import com.ruoyi.web.modules.circulation.support.TradeMarketRules;
import com.ruoyi.web.modules.trading.domain.BizMarketDailyQuote;
import com.ruoyi.web.modules.trading.support.MarketDailyQuoteRules;

/**
 * 市场行情登记测试样本。
 */
public final class MarketDailyQuoteTestSamples
{
    public static final Long TRADE_MARKET_ID = 1L;

    private MarketDailyQuoteTestSamples()
    {
    }

    public static BizTradeMarket activeTradeMarket()
    {
        BizTradeMarket m = new BizTradeMarket();
        m.setId(TRADE_MARKET_ID);
        m.setMarketName("巴青交易市场");
        m.setOperateStatus(TradeMarketRules.OPERATE_STATUS_NORMAL);
        m.setDelFlag(TradeMarketRules.DEL_FLAG_NORMAL);
        return m;
    }

    public static BizMarketDailyQuote validSaveRow() throws ParseException
    {
        BizMarketDailyQuote row = new BizMarketDailyQuote();
        row.setQuoteDate(parseDate("2026-05-19"));
        row.setProvinceCode("540000");
        row.setProvinceName("西藏自治区");
        row.setCityCode("540600");
        row.setCityName("那曲市");
        row.setCountyCode("540628");
        row.setCountyName("巴青县");
        row.setTradeMarketId(TRADE_MARKET_ID);
        row.setCattleGender(MarketDailyQuoteRules.CATTLE_GENDER_BULL);
        row.setPriceMin(new BigDecimal("10"));
        row.setPriceMax(new BigDecimal("14"));
        row.setPriceUnit(MarketDailyQuoteRules.PRICE_UNIT_PER_JIN);
        row.setSupplyStatus(1);
        row.setChangeFactorList(Arrays.asList(1, 3));
        row.setProbRise(new BigDecimal("40"));
        row.setProbFlat(new BigDecimal("35"));
        row.setProbFall(new BigDecimal("25"));
        row.setOutboundAdvice("出栏平稳");
        return row;
    }

    public static Date parseDate(String text) throws ParseException
    {
        return new SimpleDateFormat("yyyy-MM-dd").parse(text);
    }
}
