package com.cool.store.enums.tp;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * <p>
 * 十二分制-单据类型 枚举类
 * </p>
 *
 * @author wangff
 * @since 2025/11/6
 */
@Getter
@AllArgsConstructor
public enum TpFormTypeEnum {

    REWARD(0, "加分申请单", "加分申请单"),
    WARNING(1, "警告书", "惩处申请单"),
    PENALTY(2, "处罚书", "惩处申请单"),
    APPEAL(3, "复议申请单", "复议申请单"),
    ;

    private final Integer type;

    private final String msg;

    private final String alias;

    public static String getMsgByType(Integer type) {
        for (TpFormTypeEnum value : values()) {
            if (value.type.equals(type)) {
                return value.msg;
            }
        }
        return null;
    }

    public static TpFormTypeEnum getByType(Integer type) {
        for (TpFormTypeEnum value : values()) {
            if (value.type.equals(type)) {
                return value;
            }
        }
        return null;
    }

    /**
     * 是惩处单
     */
    public static boolean isPenalty(Integer type) {
        return PENALTY.getType().equals(type) || WARNING.getType().equals(type);
    }
}
