package com.sdtool.common.datas.design;

import java.util.Objects;

/**
 * 设计模板元素类型
 */
@SuppressWarnings("unused")
public enum TemplateItemType {
    background("背景", "background"),
    text("文本", "text"),
    image("图片", "image");
    private String name;
    private String value;

    TemplateItemType(String name, String value) {
        this.name = name;
        this.value = value;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public static String getName(String value) {
        for (TemplateItemType p : TemplateItemType.values()) {
            if (Objects.equals(p.getValue(), value)) return p.getName();
        }
        return null;
    }
}
