package com.ruoyi.web.modules.epidemic.support;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import com.ruoyi.web.modules.epidemic.EpidemicReportTestSamples;

/**
 * YQSB-UT-001～003、008～009、016
 */
@DisplayName("EpidemicReportRules")
class EpidemicReportRulesTest
{

    @Test
    @DisplayName("YQSB-UT-001 传播途径枚举")
    void ut001_transmissionRoute()
    {
        assertTrue(EpidemicReportRules.isTransmissionRouteValid(1));
        assertTrue(EpidemicReportRules.isTransmissionRouteValid(4));
        assertFalse(EpidemicReportRules.isTransmissionRouteValid(0));
        assertFalse(EpidemicReportRules.isTransmissionRouteValid(5));
    }

    @Test
    @DisplayName("YQSB-UT-002 疫病类型枚举")
    void ut002_epidemicType()
    {
        assertTrue(EpidemicReportRules.isEpidemicTypeValid(1));
        assertFalse(EpidemicReportRules.isEpidemicTypeValid(9));
    }

    @Test
    @DisplayName("YQSB-UT-003 风险等级枚举")
    void ut003_riskLevel()
    {
        assertTrue(EpidemicReportRules.isRiskLevelValid(3));
        assertFalse(EpidemicReportRules.isRiskLevelValid(4));
    }

    @Test
    @DisplayName("YQSB-UT-008 可编辑判定")
    void ut008_canEdit()
    {
        assertTrue(EpidemicReportRules.canEdit(EpidemicReportTestSamples.sampleOpen()));
        assertFalse(EpidemicReportRules.canEdit(EpidemicReportTestSamples.sampleRelieved()));
    }

    @Test
    @DisplayName("YQSB-UT-009 可解除判定")
    void ut009_canRelieve()
    {
        assertTrue(EpidemicReportRules.canRelieve(EpidemicReportTestSamples.sampleOpen()));
        assertFalse(EpidemicReportRules.canRelieve(EpidemicReportTestSamples.sampleRelieved()));
    }

    @Test
    @DisplayName("YQSB-UT-016 relieveStatus 派生")
    void ut016_relieveStatus()
    {
        assertEquals(0, EpidemicReportRules.resolveRelieveStatus(null));
        assertEquals(1, EpidemicReportRules.resolveRelieveStatus(EpidemicReportTestSamples.sampleRelieved().getReleaseDate()));
    }
}
