package com.qunzhixinxi.hnqz.admin.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * {@code CertStatus}
 * <p>
 * 易联数科签约状态枚举
 *
 * @author Hengchen.Sun
 * @version 1.0.0
 * @date 2022/03/09 22:21
 */
@Getter
@AllArgsConstructor
public enum YeeCertStatus {

    UN_SIGNED("0", "未签约"),
    SIGNED("1", "已签约"),
    TERMINATED("2", "已解约");

    private final String code;

    private final String message;

    /**
     * 根据枚举编码获取枚举对象
     *
     * @param code 枚举编码
     * @return 如果存在返回枚举，否则返回 {@code null}
     */
    public static YeeCertStatus resolve(final String code) {
        for (YeeCertStatus yeeCertStatus : YeeCertStatus.values()) {
            if (yeeCertStatus.getCode().equals(code)) {
                return yeeCertStatus;
            }
        }
        return UN_SIGNED;

    }
}