package com.zd.common.core.enums;

import com.fasterxml.jackson.annotation.JsonFormat;

import java.util.Arrays;

/**
 * @Author: zhoupan
 * @Date: 2021/09/10/15:47
 * @Description:
 */
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum AuditStatusEnum implements BaseEnum<Integer> {

    TO_AUDIT(0, "待审核"),
    SUCCESS(1, "已通过"),
    FAIL(2, "未通过"),
    NO_COMMIT(3, "未提交"),
    ;

    private Integer code;
    private String name;

    AuditStatusEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public static AuditStatusEnum getByCode(Integer code) {
        return Arrays.stream(AuditStatusEnum.values()).filter(a -> a.code.equals(code)).findFirst().orElse(null);
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

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

    @Override
    public Integer getDictKey() {
        return code;
    }
}
