package cn.com.ctop.kuaishou.modules.live.enums;

import java.util.HashMap;
import java.util.Map;

/**
 * 直播数据——省份/年龄、价格、性别报表 字段枚举，
 * 用于锁定EXCEL顺序不同时的字段与数据的对应关系
 */
public enum ProvinceEnum {
    PARAMETER001("province", "省份"),
    PARAMETER002("price", "设备价格"),
    PARAMETER003("age", "年龄分段"),
    PARAMETER004("gender", "性别"),
    PARAMETER2("charge", "花费"),
    PARAMETER3("shows", "曝光数"),
    PARAMETER4("photoShow", "封面曝光数"),
    PARAMETER5("photoClickRatio", "封面点击率"),
    PARAMETER6("aclick", "素材曝光数"),
    PARAMETER7("bclick", "行为数"),
    PARAMETER8("actionRatio", "行为率"),
    PARAMETER9("liveFans", "涨粉数"),
    PARAMETER10("liveFansCost", "涨粉成本"),
    PARAMETER11("productClick", "直播间商品点击数"),
    PARAMETER12("liveWatchCount", "直播观看数"),
    PARAMETER13("liveWatchCost", "直播观看成本"),
    PARAMETER14("likes", "作品点赞数"),
    PARAMETER15("shares", "作品分享数"),
    PARAMETER16("comments", "作品评论数"),
    PARAMETER17("play3sCount", "作品3秒播放数"),
    PARAMETER18("eventAppointSuccess", "预约成功数");

    private String code;
    private String name;

    ProvinceEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public static String getCodeByName(String name) {
        for (ProvinceEnum material : ProvinceEnum.values()) {
            if (material.getName().equals(name)) {
                return material.getCode();
            }
        }
        return "";
    }
     public static String getNameByCode(String code) {
        for (ProvinceEnum material : ProvinceEnum.values()) {
            if (material.getCode().equals(code)) {
                return material.getName();
            }
        }
        return "";
    }

    public String getName() {
        return name;
    }

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

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    @Override
    public String toString() {
        return "MaterialEnum{" +
                "code='" + code + '\'' +
                ", name=" + name +
                '}';
    }

    public static Map<String, String> getMap() {
        Map<String, String> map = new HashMap<>();
        for (ProvinceEnum material : ProvinceEnum.values()) {
            map.put(material.getName(), material.getCode());
        }
        return map;
    }
}
