package com.ai.da.model.enums;

import com.fasterxml.jackson.annotation.JsonValue;
import io.netty.util.internal.StringUtil;

public enum PrintboardLevel2TypeEnum implements IEnumDisplay {
    PATTERN("图案", "Pattern"),
    LOGO("标志", "Logo"),
    SLOGAN("标语", "Slogan")
    ;

    private final String chinese;
    private final String english;

    // 构造函数
    PrintboardLevel2TypeEnum(String chinese, String english) {
        this.chinese = chinese;
        this.english = english;
    }

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

    // 获取中文描述
    public String getChinese() {
        return chinese;
    }

    // 获取英文描述
    public String getEnglish() {
        return english;
    }

    // 重写toString方法，返回格式化的描述
    @Override
    public String toString() {
        return chinese + " (" + english + ")";
    }

    // 根据名称获取枚举值
    public static PrintboardLevel2TypeEnum fromName(String name) {
        if (StringUtil.isNullOrEmpty(name)){
            return PrintboardLevel2TypeEnum.PATTERN;
        }
        for (PrintboardLevel2TypeEnum designElement : PrintboardLevel2TypeEnum.values()) {
            if (designElement.english.equals(name)) {
                return designElement;
            }
        }
        throw new IllegalArgumentException("No enum constant for name: " + name);
    }
}
