package com.qmth.teachcloud.common.enums.log;

import com.qmth.teachcloud.common.enums.EnumResult;

import java.util.ArrayList;
import java.util.List;

/**
 * @Description: 系统自定义日志操作类型
 * @Author: CaoZixuan
 * @Date: 2022-11-29
 */
public enum CustomizedOperationTypeEnum {
    LOGIN("用户登录", OperationTypeEnum.UN_KNOW),
    LOGOUT("用户登出", OperationTypeEnum.UN_KNOW),
    EDIT("编辑",OperationTypeEnum.EDIT),
    ADD("新增", OperationTypeEnum.EDIT),
    DELETE("删除", OperationTypeEnum.DELETE),
    UPDATE("修改", OperationTypeEnum.EDIT),
    SEARCH("查询", OperationTypeEnum.SELECT),
    IMPORT("导入", OperationTypeEnum.EDIT),
    EXPORT("导出", OperationTypeEnum.SELECT),
    PUSH("推送", OperationTypeEnum.UN_KNOW),
    PREVIEW("预览", OperationTypeEnum.UN_KNOW),
    UN_KNOW("未知", OperationTypeEnum.UN_KNOW);
    private final String desc;
    private final OperationTypeEnum operationType;

    CustomizedOperationTypeEnum(String desc, OperationTypeEnum operationType) {
        this.desc = desc;
        this.operationType = operationType;
    }

    public String getDesc() {
        return desc;
    }

    public OperationTypeEnum getOperationType() {
        return operationType;
    }

    public static List<EnumResult> listTypes() {
        List<EnumResult> list = new ArrayList<EnumResult>();
        for (CustomizedOperationTypeEnum value : CustomizedOperationTypeEnum.values()) {
            EnumResult result = new EnumResult();
            result.setName(value.name());
            result.setOrdinal(value.ordinal());
            result.setCode(null);
            result.setDesc(value.getDesc());
            list.add(result);
        }
        return list;
    }
}
