package com.sckw.core.model.enums;

import lombok.Getter;

/**
 * @author czh
 * @desc 合同状态
 * @date 2023/7/14
 */
@Getter
public enum ContractStatusEnum {
    //已签约
    SIGNED(0, "已签约"),
    //已完结
    COMPLETE(2, "已完结"),
    //已保存
    SAVE(3, "已保存"),
    //签约中
    SUBMIT(1, "待签约"),
    //待审核
    WAIT_APPROVE(4, "待审核"),
    //审核中
    CANNEL(5, "已作废");

    private final int code;

    private final String name;

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

    public static ContractStatusEnum getName(int code) {
        for (ContractStatusEnum contractTrackEnum : values()) {
            if (contractTrackEnum.getCode() == code) {
                return contractTrackEnum;
            }
        }
        return null;
    }

    public static String getNameByCode(int code) {
        for (ContractStatusEnum contractTrackEnum : values()) {
            if (contractTrackEnum.getCode() == code) {
                return contractTrackEnum.getName();
            }
        }
        return null;
    }

}
