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

import java.util.Date;
import com.ruoyi.web.modules.epidemic.domain.BizEpidemicReport;

/**
 * 疫情上报处置状态与枚举白名单。
 */
public final class EpidemicReportRules
{
    public static final int RELIEVE_STATUS_OPEN = 0;

    public static final int RELIEVE_STATUS_DONE = 1;

    private EpidemicReportRules()
    {
    }

    public static boolean isRelieved(BizEpidemicReport row)
    {
        return row != null && row.getReleaseDate() != null;
    }

    public static boolean canEdit(BizEpidemicReport row)
    {
        return row != null && !isRelieved(row);
    }

    public static boolean canRelieve(BizEpidemicReport row)
    {
        return canEdit(row);
    }

    public static int resolveRelieveStatus(Date releaseDate)
    {
        return releaseDate == null ? RELIEVE_STATUS_OPEN : RELIEVE_STATUS_DONE;
    }

    public static boolean isTransmissionRouteValid(Integer value)
    {
        return value != null && value >= 1 && value <= 4;
    }

    public static boolean isEpidemicTypeValid(Integer value)
    {
        return value != null && value >= 1 && value <= 4;
    }

    public static boolean isRiskLevelValid(Integer value)
    {
        return value != null && value >= 1 && value <= 3;
    }
}
