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

import lombok.Getter;

/**
 * @author salmanoe
 * @version 1.0.0
 * @since 19/10/2023
 */
public enum GolonganDarah {
    A(1, "A"),
    B(2, "B"),
    O(3, "O"),
    AB(4,"AB");

    private final long id;

    @Getter
    private final String name;

    GolonganDarah(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 GolonganDarah valueOf(long id) {
        for (GolonganDarah golonganDarah : values()) {
            if (golonganDarah.id == id) {
                return golonganDarah;
            }
        }
        throw new IllegalArgumentException("No matching constant for [" + id + "]");
    }
}
