package gc.mda.kcg.domain.aircraft;

import com.fasterxml.jackson.annotation.JsonValue;

public enum AircraftCategory {
    MILITARY,
    TANKER,
    SURVEILLANCE,
    FIGHTER,
    CARGO,
    CIVILIAN,
    UNKNOWN;

    @JsonValue
    public String toValue() {
        return name().toLowerCase();
    }

    public static AircraftCategory fromString(String value) {
        if (value == null) return UNKNOWN;
        try {
            return valueOf(value.toUpperCase());
        } catch (IllegalArgumentException e) {
            return UNKNOWN;
        }
    }
}
