package net.northking.cctp.element.mobile.enums;

import com.alibaba.fastjson.JSON;
import net.northking.cctp.element.core.type.EnumClass;

import java.util.*;

/**
 * <p>是否枚举类</p>
 */
public enum WhetherOrNotEnum implements EnumClass {

    YES("是", "1"),
    NO("否", "0");

    private String key;
    private String value;

    WhetherOrNotEnum(String key, String value){
        this.key = key;
        this.value = value;
    }

    @Override
    public String getEnumData() {
        List<Map<String,Object>> result = new ArrayList<>();
        for (WhetherOrNotEnum nullEnum : EnumSet.allOf(WhetherOrNotEnum.class)) {
            Map<String,Object> one = new HashMap();
            one.put("label",nullEnum.key);
            one.put("value",nullEnum.value);
            result.add(one);
        }
        return JSON.toJSONString(result);
    }
}
