package com.ai.da.model.enums;

import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Data;

public enum AgeGroup implements IEnumDisplay {
    ADULT("Adult"),
    CHILD("Child")
    ;

    private String value;

    AgeGroup(String value) {
        this.value = value;
    }

    @Override
    @JsonValue
    public String getValue() {
        return this.value;
    }

    public static AgeGroup getAgeGroup(String value) {
        for (AgeGroup group : values()) {
            if (group.value.equalsIgnoreCase(value)) {
                return group;
            }
        }
        throw new IllegalArgumentException("No matching constant for [" + value + "]");
    }

    public static boolean isValidName(String name) {
        for (AgeGroup ageGroup : AgeGroup.values()) {
            if (ageGroup.getValue().equalsIgnoreCase(name)) {
                return true;
            }
        }
        return false;
    }
}
