package com.yuchen.saas.integration.feign.api.enums;

import org.apache.commons.lang3.StringUtils;

import java.util.HashMap;
import java.util.Map;

/**
 * @author 林立超
 * @create 2020/10/17 14:45
 */
public class ActEnum {

    static Map<String, AuditType> auditTypeMap = new HashMap<>();


    public enum ActType {
        CUSTOM("0", "自定义流程"),
        CPBG("cpbg", "车牌变更"),
        YKCPBG("ykcpbg", "月卡车牌变更"),
        CZBG("czbg", "车主变更"),
        YKCZBG("yzcpbg", "月卡车主变更"),
        CSSH("cssh", "错时审核"),
        YKSH("yksh", "月卡审核"),
        CSSQ("cssq", "错时申请"),
        YKSQ("yksq", "月卡申请"),
        YKDC("ykdc", "一卡多车申请"),
        MORF_ACT("morf_act", "多订单月卡退款审核"),
        MORF_CHS_ACT("morf_chs_act", "多订单错时卡退款审核"),
        MORF_WALLET_ACT("morf_wallet_act", "多订单钱包退款审核"),
        MORF_STOPING_ACT("morf_stoping_act", "多订单临停退款审核"),
        MORF_OCCUPANCY_ACT("morf_occupancy_act", "多订单占位费退款审核"),
        MORF_CHARGE_ACT("morf_charge_act", "多订单充电费退款审核"),
        GR_AUTH_ACT("gr_auth_act", "个人认证"),
        QY_AUTH_ACT("qy_auth_act", "组织认证"),
        DTC_AUTH_ACT("dtc_auth_act", "动态车申请"),
        AB_CAR_ACT("ab_car_act", "AB车申请审核"),
        ;
        private String flag;
        private String describe;

        private ActType(String flag, String describe) {
            this.flag = flag;
            this.describe = describe;
        }

        public static ActType getActType(String actType) {
            ActType t[] = ActType.values();
            if (StringUtils.isBlank(actType)) {
                return null;
            }
            for (ActType a : t) {
                if (StringUtils.equals(a.getFlag(), actType)) {
                    return a;
                }
            }
            return null;
        }

        public String getDescribe() {
            return describe;
        }

        public String getFlag() {
            return flag;
        }
    }

    public enum TaskType {
        CREATE("0", "创建"),
        APPROVER("1", "审批");
        private String flag;
        private String describe;

        private TaskType(String flag, String describe) {
            this.flag = flag;
            this.describe = describe;
        }

        public String getDescribe() {
            return describe;
        }

        public String getFlag() {
            return flag;
        }
    }

    public enum ActState {
        NOPASS("0"),
        PASS("1"),
        RUNNING("2"),
        CANCEL("3"),
        //待审核申请后为待审核
        TO_BE_REVIEWED("4"),

        ;
        private String flag;

        private ActState(String flag) {
            this.flag = flag;
        }


        public String getFlag() {
            return flag;
        }
    }


    public enum NodeState {
        NOPASS(0),
        PASS(1),
        RUNNING(2);
        private int flag;
        private NodeState(int flag) {
            this.flag = flag;
        }
        public int getFlag() {
            return flag;
        }
    }


    public enum AuditType {
        STARTER("starter"),
        LOGINNAME("loginName"),
        AND("and"),
        OR("or"),
        ONE("one");

        private String message;
        private AuditType(String message) {
            this.message = message;
        }
        public static AuditType getAuditType(String message) {
            return auditTypeMap.get(message);
        }
        public static AuditType getAuditTypeByOrdin(int ordinal) {
            AuditType[] auditTypes = AuditType.values();
            for (AuditType t : auditTypes) {
                if (ordinal == t.ordinal()) {
                    return t;
                }
            }
            return null;
        }
        public String getMessage() {
            return this.message;
        }
    }




    public enum MeetingState {
        //审批不通过
        NotPass,
        //PASS
        PASS,
        //审批中
        Approval,
        //待开始
        Tobegin,
        //进行中
        Ongoing,
        //已结束
        End,
        //已取消
        Cancel;
    }

    public enum CountersignatureType {
        Countersignature("0"),
        Undertake("1");
        private String code;

        private CountersignatureType(String code) {
            this.code = code;
        }

        public String getCode() {
            return this.code;
        }

    }

    public enum AutoFlag {
        REFUSE("0"),
        PASS("1");
        private String code;

        private AutoFlag(String code) {
            this.code = code;
        }

        public String getCode() {
            return this.code;
        }

    }


}
