package com.cool.store.enums;

/**
 * 营业执照类型 0.个体工商户 1.有限责任公司 2.独资企业 3.自然人经营
 */
public enum LicenseTypeEnum {
    ZERO(0, "个体工商户"),
    ONE(1,"有限责任公司"),
    TWO(2,"独资企业"),
    THREE(3,"自然人经营");

    private Integer code;

    private String message;

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    LicenseTypeEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public static LicenseTypeEnum match(Integer code) {
        for (LicenseTypeEnum type : LicenseTypeEnum.values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        return null;
    }

    public static LicenseTypeEnum matchName(String name) {
        for (LicenseTypeEnum type : LicenseTypeEnum.values()) {
            if (type.getMessage().equals(name)) {
                return type;
            }
        }
        return null;
    }
}
