package com.tofly.gpsboot.common.system;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.springframework.util.StringUtils;

/**
 * 审核类型
 *
 * @author Zev
 */
@Getter
@AllArgsConstructor
public enum AuditTypeEnum {
    /**
     *
     */
    AUDIT_TYPE_YEAR_PLAN("00", "年计划审核", "AUDIT_TYPE_YEAR_PLAN"),
    AUDIT_TYPE_MONTHLY_PLAN("01", "月计划审核", "AUDIT_TYPE_MONTHLY_PLAN"),
    AUDIT_TYPE_HIDDEN_TROUBLE("02", "隐患审核", "AUDIT_TYPE_HIDDEN_TROUBLE"),
    AUDIT_TYPE_HIDDEN_TROUBLE_ELIMINATION("03", "隐患消除审核", "AUDIT_TYPE_HIDDEN_TROUBLE_ELIMINATION"),
    AUDIT_TYPE_CONSTRUCTION_SITE("04", "工地审核", "AUDIT_TYPE_CONSTRUCTION_SITE"),
    AUDIT_TYPE_CONSTRUCTION_SITE_ELIMINATION("05", "工地监护消除审核", "AUDIT_TYPE_CONSTRUCTION_SITE_ELIMINATION"),
    AUDIT_TYPE_PLAN_STOP("06", "任务暂停审核", "AUDIT_TYPE_PLAN_STOP"),
    AUDIT_TYPE_PLAN_DISUSE("07", "任务作废审核", "AUDIT_TYPE_PLAN_DISUSE"),
    AUDIT_TYPE_REPAIR_YEAR_PLAN("08", "抢维修年计划审核", "AUDIT_TYPE_REPAIR_YEAR_PLAN"),
    AUDIT_TYPE_REPAIR_PLAN("09","抢维修临时(计划)工单派工","AUDIT_TYPE_REPAIR_PLAN"),
    AUDIT_TYPE_REPAIR_RECORD("10","抢维修工单处理审核","AUDIT_REPAIR_ORDER_OVER"),
    AUDIT_TYPE_REPAIR_MONTH_PLAN("11", "抢维修月计划审核", "AUDIT_TYPE_REPAIR_MONTH_PLAN"),
    ;
    /**
     * 编码
     */
    private String code;
    /**
     * 内容
     */
    private String value;

    /**
     * 注入服务名称
     */
    private String injectionServerType;

    public static String getCodeForValue(String code) {
        String path = "";
        if (StringUtils.isEmpty(code)) {
            return path;
        }

        for (AuditTypeEnum e : AuditTypeEnum.values()) {
            if (e.code.equalsIgnoreCase(code)) {
                path = e.value;
                break;
            }
        }
        return path;
    }

    public static String getCodeForInjectionServerType(String code) {
        String path = "";
        if (StringUtils.isEmpty(code)) {
            return path;
        }

        for (AuditTypeEnum e : AuditTypeEnum.values()) {
            if (e.code.equalsIgnoreCase(code)) {
                path = e.injectionServerType;
                break;
            }
        }
        return path;
    }
}
