package fr.titionfire.ffsaf.utils;

import io.quarkus.runtime.annotations.RegisterForReflection;

@RegisterForReflection
public enum Genre {
    H("Homme"),
    F("Femme"),
    NA("Non définie");

    public final String str;

    Genre(String name) {
        this.str = name;
    }

    public static Genre fromString(String genre) {
        if (genre == null) {
            return NA;
        }
        if (genre.equalsIgnoreCase("Homme") || genre.equalsIgnoreCase("H")) {
            return H;
        } else if (genre.equalsIgnoreCase("Femme") || genre.equalsIgnoreCase("F")) {
            return F;
        } else {
            return NA;
        }
    }

    @Override
    public String toString() {
        return str;
    }
}
