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

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;

@DisplayName("ServiceAppointmentRules")
class ServiceAppointmentRulesTest
{
    @Test
    @DisplayName("可确认/拒绝仅待确认")
    void canConfirmOrReject()
    {
        assertTrue(ServiceAppointmentRules.canConfirmOrReject(ServiceAppointmentRules.STATUS_PENDING));
        assertFalse(ServiceAppointmentRules.canConfirmOrReject(ServiceAppointmentRules.STATUS_CONFIRMED));
        assertFalse(ServiceAppointmentRules.canConfirmOrReject(ServiceAppointmentRules.STATUS_CANCELLED));
    }

    @Test
    @DisplayName("兽医列表状态合法集")
    void vetListStatus()
    {
        assertTrue(ServiceAppointmentRules.isVetListStatusValid(null));
        assertTrue(ServiceAppointmentRules.isVetListStatusValid(0));
        assertTrue(ServiceAppointmentRules.isVetListStatusValid(4));
        assertFalse(ServiceAppointmentRules.isVetListStatusValid(5));
    }

    @Test
    @DisplayName("机构列表状态合法集")
    void orgListStatus()
    {
        assertTrue(ServiceAppointmentRules.isOrgListStatusValid(null));
        assertTrue(ServiceAppointmentRules.isOrgListStatusValid(ServiceAppointmentRules.STATUS_BOOKED));
        assertTrue(ServiceAppointmentRules.isOrgListStatusValid(ServiceAppointmentRules.STATUS_CANCELLED));
        assertTrue(ServiceAppointmentRules.isOrgListStatusValid(ServiceAppointmentRules.STATUS_COMPLETED));
        assertFalse(ServiceAppointmentRules.isOrgListStatusValid(ServiceAppointmentRules.STATUS_PENDING));
        assertFalse(ServiceAppointmentRules.isOrgListStatusValid(ServiceAppointmentRules.STATUS_CONFIRMED));
    }

    @Test
    @DisplayName("机构可见状态")
    void orgVisibleStatus()
    {
        assertTrue(ServiceAppointmentRules.isOrgStatusVisible(ServiceAppointmentRules.STATUS_BOOKED));
        assertFalse(ServiceAppointmentRules.isOrgStatusVisible(ServiceAppointmentRules.STATUS_PENDING));
    }

    @Test
    @DisplayName("完成接诊-兽医专家仅已确认")
    void canCompleteVetOrExpert()
    {
        assertFalse(ServiceAppointmentRules.canCompleteVetOrExpert(ServiceAppointmentRules.STATUS_PENDING));
        assertTrue(ServiceAppointmentRules.canCompleteVetOrExpert(ServiceAppointmentRules.STATUS_CONFIRMED));
        assertFalse(ServiceAppointmentRules.canCompleteVetOrExpert(ServiceAppointmentRules.STATUS_COMPLETED));
    }

    @Test
    @DisplayName("完成接诊-机构仅已预约")
    void canCompleteOrg()
    {
        assertTrue(ServiceAppointmentRules.canCompleteOrg(ServiceAppointmentRules.STATUS_BOOKED));
        assertFalse(ServiceAppointmentRules.canCompleteOrg(ServiceAppointmentRules.STATUS_COMPLETED));
        assertFalse(ServiceAppointmentRules.canCompleteOrg(ServiceAppointmentRules.STATUS_CANCELLED));
    }

    @Test
    @DisplayName("专家列表状态与兽医一致")
    void expertListStatus()
    {
        assertTrue(ServiceAppointmentRules.isExpertListStatusValid(0));
        assertTrue(ServiceAppointmentRules.isExpertListStatusValid(4));
        assertFalse(ServiceAppointmentRules.isExpertListStatusValid(5));
    }
}
