package com.ruoyi.web.modules.technology;

import java.util.Calendar;
import java.util.Date;
import com.ruoyi.web.modules.technology.domain.BizPracticalTraining;
import com.ruoyi.web.modules.technology.support.PracticalTrainingRules;

/**
 * 实战业务培训测试样本。
 */
public final class PracticalTrainingTestSamples
{
    private PracticalTrainingTestSamples()
    {
    }

    public static BizPracticalTraining sampleDraft()
    {
        BizPracticalTraining row = new BizPracticalTraining();
        row.setTrainingTopic("牧业实战测试");
        row.setTrainingIntro("简介文本");
        row.setPlannedHeadCount(30);
        row.setTrainingLocation("县培训中心");
        row.setRegistrationStartTime(parse("2025-08-01 08:00:00"));
        row.setRegistrationEndTime(parse("2025-08-15 18:00:00"));
        row.setTrainingTime(parse("2025-08-25 09:00:00"));
        row.setPublishStatus(PracticalTrainingRules.PUBLISH_STATUS_DRAFT);
        row.setActualEnrolledCount(0);
        return row;
    }

    public static BizPracticalTraining samplePublishedFutureReg()
    {
        BizPracticalTraining row = sampleDraft();
        row.setPublishStatus(PracticalTrainingRules.PUBLISH_STATUS_PUBLISHED);
        Calendar cal = Calendar.getInstance();
        cal.add(Calendar.DAY_OF_MONTH, 30);
        row.setRegistrationStartTime(cal.getTime());
        cal.add(Calendar.DAY_OF_MONTH, 10);
        row.setRegistrationEndTime(cal.getTime());
        cal.add(Calendar.DAY_OF_MONTH, 5);
        row.setTrainingTime(cal.getTime());
        return row;
    }

    private static Date parse(String pattern)
    {
        try
        {
            return new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(pattern);
        }
        catch (Exception ex)
        {
            throw new RuntimeException(ex);
        }
    }
}
