package com.ruoyi.web.modules.trading;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import com.ruoyi.web.modules.trading.domain.BizIsolationPatrol;
import com.ruoyi.web.modules.trading.domain.BizIsolationPen;
import com.ruoyi.web.modules.trading.support.EntryIsolationRules;

/**
 * 隔离巡查登记测试样本。
 */
public final class IsolationPatrolTestSamples
{
    public static final Long PEN_ID_1 = 1L;

    public static final Long PATROL_ID = 1001L;

    private IsolationPatrolTestSamples()
    {
    }

    public static BizIsolationPen activePen()
    {
        BizIsolationPen pen = new BizIsolationPen();
        pen.setId(PEN_ID_1);
        pen.setPenCode("01");
        pen.setDelFlag(EntryIsolationRules.DEL_FLAG_NORMAL);
        return pen;
    }

    public static BizIsolationPatrol normalSaveRow() throws ParseException
    {
        BizIsolationPatrol row = new BizIsolationPatrol();
        row.setPatrolTime(parseDateTime("2026-05-20 14:00:00"));
        row.setPenId(PEN_ID_1);
        row.setSickDeadQty(0);
        row.setContentDesc("巡查结果正常");
        row.setHandleDesc("无需处理");
        return row;
    }

    public static BizIsolationPatrol abnormalSaveRow() throws ParseException
    {
        BizIsolationPatrol row = new BizIsolationPatrol();
        row.setPatrolTime(parseDateTime("2026-05-20 15:00:00"));
        row.setPenId(PEN_ID_1);
        row.setSickDeadQty(2);
        row.setContentDesc("巡查结果异常");
        row.setHandleDesc("需要处理");
        row.setEarTagList(Arrays.asList("E001", "E002"));
        return row;
    }

    public static BizIsolationPatrol persistedRow() throws ParseException
    {
        BizIsolationPatrol row = normalSaveRow();
        row.setId(PATROL_ID);
        row.setPenCode("01");
        row.setDelFlag(EntryIsolationRules.DEL_FLAG_NORMAL);
        return row;
    }

    public static Date parseDateTime(String text) throws ParseException
    {
        SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        fmt.setLenient(false);
        return fmt.parse(text);
    }

    public static java.util.List<String> inStockTags()
    {
        return Arrays.asList("E001", "E002", "E003");
    }

    public static java.util.List<String> allocEarTagRows()
    {
        return Arrays.asList("E001,E002", "E003");
    }

    public static java.util.List<String> emptyTags()
    {
        return Collections.emptyList();
    }
}
