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 Position implements IEnumDisplay {
    OVERALL("Overall"),
    TOPS("Tops"),
    BOTTOMS("Bottoms"),
    OUTWEAR("Outwear"),
    BLOUSE("Blouse"),
    DRESS("Dress"),
    TROUSERS("Trousers"),
    SKIRT("Skirt"),
    SLOGAN("Slogan"),
    LOGO("Logo"),
    PATTERN("Pattern"),
    OTHERS("Others");

    private String value;

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

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

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

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