package com.jasamedika.medifirst2000.etl.pasien.constant;

import lombok.Getter;

/**
 * @author salmanoe
 * @version 1.0.0
 * @since 19/10/2023
 */
public enum Sapaan {
    TUAN(1, "Tuan", 17, 50),
    NYONYA(2, "Nyonya", 17, 50),
    ANAK(3, "Anak", 4, 10),
    BAYI(4, "Bayi", 1, 2),
    NONA(5, "Nona", 11, 21);

    private final long id;

    @Getter
    private final String name;

    @Getter
    private final Integer minAge;

    @Getter
    private final Integer maxAge;

    Sapaan(long id, String name, Integer minAge, Integer maxAge) {
        this.id = id;
        this.name = name;
        this.minAge = minAge;
        this.maxAge = maxAge;
    }

    public long id() {
        return this.id;
    }

    @Override
    public String toString() {
        return Long.toString(id);
    }

    public static Sapaan valueOf(long id) {
        for (Sapaan sapaan : values()) {
            if (sapaan.id == id) {
                return sapaan;
            }
        }
        throw new IllegalArgumentException("No matching constant for [" + id + "]");
    }
}
