package cn.com.qmth.stmms.ms.core.domain;

import java.util.*;

/**
 * @Description: 操作日志类型
 * @Param:
 * @return:
 * @Author: wangliang
 * @Date: 2019/10/19
 */
public enum MarkLogOperType {

    /**
     * 分档
     */
    LEVEL(1, "分档"),

    /**
     * 打分
     */
    SCORE(2, "打分"),

    /**
     * 回评档位
     */
    ONCE_LEVEl(3, "回评分档"),

    /**
     * 回评分数
     */
    ONCE_SCORE(4, "回评打分"),

    /**
     * 回评档位
     */
    CALLBACK_LEVEl(5, "建议档位打回"),

    /**
     * 档位打回回评
     */
    CALLBACK_ONCE_LEVEL(6, "档位打回回评"),

    /**
     * 一键定档
     */
    ONE_CLICK_LEVEl(7, "一键定档"),

    /**
     * 标准卷设置
     */
    CRITERION_PAPER_SET(8, "标准卷设置"),

    /**
     * 采集
     */
    COLLECT(9, "采集"),

    /**
     * 系统自动打回
     */
    SYSTEM_CALLBACK_LEVEl(10, "系统自动打回"),

    /**
     * 重评
     */
    REEVALUATION_LEVEl(11, "重评"),

    /**
     * 手动打回
     */
    HANDLE_LEVEl(12, "手动打回"),

    /**
     * 档位落差
     */
    LEVEl_DIFFERENCE(13, "档位落差"),

    /**
     * 档位偏差
     */
    LEVEl_DEVIATION(14, "档位偏差"),

    /**
     * 改档申请
     */
    CHANGE_LEVEL_APPLY(15, "改档申请"),

    /**
     * 改档同意
     */
    CHANGE_LEVEL_AGREE(16, "改档同意"),

    /**
     * 改档打档
     */
    CHANGE_LEVEL(17, "改档打档"),

    /**
     * 改档打档
     */
    CHANGE_SCORE(18, "改档打分");

    private int id;

    private String name;

    private MarkLogOperType(int id, String name) {
        this.id = id;
        this.name = name;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    /**
     * 状态转换 toId
     *
     * @param value
     * @return
     */
    public static int convertToId(String value) {
        if (value.trim().equals(LEVEL.name)) {
            return LEVEL.getId();
        } else if (value.trim().equals(SCORE.name)) {
            return SCORE.getId();
        } else if (value.trim().equals(ONCE_LEVEl.name)) {
            return ONCE_LEVEl.getId();
        } else if (value.trim().equals(ONCE_SCORE.name)) {
            return ONCE_SCORE.getId();
        } else if (value.trim().equals(CALLBACK_LEVEl.name)) {
            return CALLBACK_LEVEl.getId();
        } else if (value.trim().equals(CALLBACK_ONCE_LEVEL.name)) {
            return CALLBACK_ONCE_LEVEL.getId();
        } else if (value.trim().equals(ONE_CLICK_LEVEl.name)) {
            return ONE_CLICK_LEVEl.getId();
        } else if (value.trim().equals(COLLECT.name)) {
            return COLLECT.getId();
        } else if (value.trim().equals(SYSTEM_CALLBACK_LEVEl.name)) {
            return SYSTEM_CALLBACK_LEVEl.getId();
        } else if (value.trim().equals(REEVALUATION_LEVEl.name)) {
            return REEVALUATION_LEVEl.getId();
        } else if (value.trim().equals(HANDLE_LEVEl.name)) {
            return HANDLE_LEVEl.getId();
        } else if (value.trim().equals(LEVEl_DIFFERENCE.name)) {
            return LEVEl_DIFFERENCE.getId();
        } else if (value.trim().equals(LEVEl_DEVIATION.name)) {
            return LEVEl_DEVIATION.getId();
        } else if (value.trim().equals(CHANGE_LEVEL_APPLY.name)) {
            return CHANGE_LEVEL_APPLY.getId();
        } else if (value.trim().equals(CHANGE_LEVEL_AGREE.name)) {
            return CHANGE_LEVEL_AGREE.getId();
        } else if (value.trim().equals(CHANGE_LEVEL.name)) {
            return CHANGE_LEVEL.getId();
        } else if (value.trim().equals(CHANGE_SCORE.name)) {
            return CHANGE_SCORE.getId();
        } else {
            return CRITERION_PAPER_SET.getId();
        }
    }

    /**
     * 状态转换 toName
     *
     * @param id
     * @return
     */
    public static String convertToName(int id) {
        if (id == LEVEL.getId()) {
            return LEVEL.name;
        } else if (id == SCORE.getId()) {
            return SCORE.name;
        } else if (id == ONCE_LEVEl.getId()) {
            return ONCE_LEVEl.name;
        } else if (id == ONCE_SCORE.getId()) {
            return ONCE_SCORE.name;
        } else if (id == CALLBACK_LEVEl.getId()) {
            return CALLBACK_LEVEl.name;
        } else if (id == CALLBACK_ONCE_LEVEL.getId()) {
            return CALLBACK_ONCE_LEVEL.name;
        } else if (id == ONE_CLICK_LEVEl.getId()) {
            return ONE_CLICK_LEVEl.name;
        } else if (id == COLLECT.getId()) {
            return COLLECT.name;
        } else if (id == SYSTEM_CALLBACK_LEVEl.getId()) {
            return SYSTEM_CALLBACK_LEVEl.name;
        } else if (id == REEVALUATION_LEVEl.getId()) {
            return REEVALUATION_LEVEl.name;
        } else if (id == HANDLE_LEVEl.getId()) {
            return HANDLE_LEVEl.name;
        } else if (id == LEVEl_DIFFERENCE.getId()) {
            return LEVEl_DIFFERENCE.name;
        } else if (id == LEVEl_DEVIATION.getId()) {
            return LEVEl_DEVIATION.name;
        } else if (id == CHANGE_LEVEL_APPLY.getId()) {
            return CHANGE_LEVEL_APPLY.name;
        } else if (id == CHANGE_LEVEL_AGREE.getId()) {
            return CHANGE_LEVEL_AGREE.name;
        } else if (id == CHANGE_LEVEL.getId()) {
            return CHANGE_LEVEL.name;
        } else if (id == CHANGE_SCORE.getId()) {
            return CHANGE_SCORE.name;
        } else {
            return CRITERION_PAPER_SET.name;
        }
    }

    /**
     * 操作日志管理类型查询
     * @return
     */
    public static List<Map> listTypes(){
        MarkLogOperType[] values = MarkLogOperType.values();
        Integer[] ints = {1, 2, 3, 4, 8, 7, 10, 5, 15, 16, 17, 18};
        List<Integer> intList = Arrays.asList(ints);
        List<Map> list = new ArrayList<>();
        for (MarkLogOperType value : values) {
            if(intList.contains(value.getId())) {
                Map map = new HashMap();
                map.put("id", value.getId());
                map.put("type", value.name());
                map.put("name", value.getName());
                list.add(map);
            }
        }
        return list;
    }
}
