package org.wfc.user.domain.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @description: 证件类型枚举
 * @since: 2025-01-08
 */
@Getter
@AllArgsConstructor
public enum IdTypeEnum {

    DRIVERS_LICENSE(1, "driver's license"),
    PASSPORT(2, "passport"),
    RESIDENCE_PERMIT(3, "residence permit"),
    STUDENT_ID(4, "student ID"),
    MEDICARE_CARD(5, "medicare card"),
    BIRTH_CERTIFICATE(6, "birth certificate");

    private final Integer code;
    private final String desc;

    public static IdTypeEnum fromCode(Integer code) {
        for (IdTypeEnum type : IdTypeEnum.values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        throw new IllegalArgumentException("Unknown code: " + code);
    }    
}
