package com.ai.da.model.enums;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonValue;

/**
 * @Author: SHAHAIBO
 * @Date: 2023/08/01 17:21
 * @Description: 服装性别分类
 */
public enum Sex implements IEnumDisplay {

    FEMALE("Female"),
    MALE("Male")

//    CHILD("Child")
    ;

    private String value;

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

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

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

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