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

/**
 * 服务预约常量与规则。
 */
public final class ServiceAppointmentRules
{
    public static final int PROVIDER_TYPE_VET = 1;

    public static final int PROVIDER_TYPE_ORG = 2;

    public static final int PROVIDER_TYPE_EXPERT = 3;

    public static final int STATUS_PENDING = 0;

    public static final int STATUS_CONFIRMED = 1;

    public static final int STATUS_REJECTED = 2;

    public static final int STATUS_CANCELLED = 3;

    public static final int STATUS_COMPLETED = 4;

    public static final int STATUS_BOOKED = 5;

    public static final int MIN_REJECT_REASON_LEN = 1;

    public static final int MAX_REJECT_REASON_LEN = 100;

    private ServiceAppointmentRules()
    {
    }

    public static boolean isVetListStatusValid(Integer status)
    {
        if (status == null)
        {
            return true;
        }
        return status >= STATUS_PENDING && status <= STATUS_COMPLETED;
    }

    /** 专家列表筛选：与兽医相同，五态 0～4。 */
    public static boolean isExpertListStatusValid(Integer status)
    {
        return isVetListStatusValid(status);
    }

    public static boolean canConfirmOrReject(int status)
    {
        return status == STATUS_PENDING;
    }

    /** 兽医/专家：已确认后可完成接诊。 */
    public static boolean canCompleteVetOrExpert(int status)
    {
        return status == STATUS_CONFIRMED;
    }

    /** 机构：已预约后可完成接诊。 */
    public static boolean canCompleteOrg(int status)
    {
        return status == STATUS_BOOKED;
    }

    /** 机构列表筛选：仅已取消、已完成、已预约。 */
    public static boolean isOrgListStatusValid(Integer status)
    {
        if (status == null)
        {
            return true;
        }
        return status == STATUS_CANCELLED || status == STATUS_COMPLETED || status == STATUS_BOOKED;
    }

    /** 机构侧可见的业务状态（登记制三态）。 */
    public static boolean isOrgStatusVisible(int status)
    {
        return status == STATUS_CANCELLED || status == STATUS_COMPLETED || status == STATUS_BOOKED;
    }
}
