package com.ruoyi.common.enums;

import java.util.Objects;

/**
 * 证件类型0身份证,10护照,20驾驶证
 */
public enum IdentityType implements IIntegerEnum {

    // 0身份证,10护照,20驾驶证
    ID_CARD(0, "身份证"),
    PASSPORT(10, "护照"),
    DRIVER_LICENSE(20, "驾驶证")
    ;


    private Integer code;
    private String msg;

    IdentityType(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    @Override
    public Object getCode() {
        return this.code;
    }

    @Override
    public String getMsg() {
        return this.msg;
    }

    public static IdentityType getByCode(int code, IdentityType[] values) {
        for (IdentityType value : values) {
            if (Objects.equals(code, value.getCode())) {
                return value;
            }
        }
        return null;
    }
}
