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

import lombok.Getter;

/**
 * @author salmanoe
 * @version 1.0.0
 * @since 19/10/2023
 */
public enum CaraLahir {
    SPONTAN(1, "Spontan"),
    SUNGSANG(2, "Sungsang"),
    EKSTRAKSI_VAKUM(3, "Ekstraksi Vakum"),
    FORCEPS(4, "Forceps"),
    SECTIO_CAESAREA(5, "Sectio Caesarea");

    private final long id;

    @Getter
    private final String name;

    CaraLahir(long id, String name) {
        this.id = id;
        this.name = name;
    }

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

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

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