package com.ruoyi.project.business.enums;

import com.ruoyi.common.exception.ServiceErrorException;
import lombok.AllArgsConstructor;
import lombok.Getter;

@AllArgsConstructor
@Getter
public enum CategoryEnum {

    // 主表
    MAIN("MAIN", "表单附件"),
    OTHER("OTHER", "其他附件"),
    DELIVERY("DELIVERY", "运单附件"),
    RECOVERY_DELIVERY("RECOVERY_DELIVERY", "回收运单"),
    RETURN_DELIVERY("RETURN_DELIVERY", "回寄运单"),
    PROVIDE_RECEIPT("PROVIDE_RECEIPT", "发放回执"),
    CHECK_RECEIPT("CHECK_RECEIPT", "校验回执"),
    TEMPERATURE_RECORD("TEMPERATURE_RECORD", "温度记录"),
    RECYCLING_LIST("RECYCLING_LIST", "回收表"),
    SUPPLY_LIST("SUPPLY_LIST", "供应表"),
    AUDIT("AUDIT", "审批附件"),
    FILE_FLUSH("FILE_FLUSH", "红冲附件"),
    // 明细
    DEVICE_STATUS("DEVICE_STATUS", "设备状态附件"),
    CALIBRATION_CERTIFICATE("CALIBRATION_CERTIFICATE", "校准证书/检定证书");

    private String value;
    private String desc;

    public static CategoryEnum from(String value) {
        for (CategoryEnum categoryEnum : values()) {
            if (categoryEnum.getValue().equals(value)) {
                return categoryEnum;
            }
        }
        throw new ServiceErrorException("非法的功能类型");
    }
}
