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

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

/**
 * 直播数据——素材报表 字段枚举，
 * 用于锁定EXCEL顺序不同时的字段与数据的对应关系
 */
public enum MaterialEnum {
    PARAMETER0("statDate", "时间"),
    PARAMETER1("videoUrl", "视频链接"),
    PARAMETER2("videoId", "视频ID"),
    PARAMETER3("charge", "花费(元)"),
    PARAMETER4("shows", "曝光数"),
    PARAMETER5("photoShow", "封面曝光数"),
    PARAMETER6("photoClickRatio", "封面点击率"),
    PARAMETER7("aclick", "素材曝光数"),
    PARAMETER8("bclick", "行为数"),
    PARAMETER9("actionRatio", "行为率"),
    PARAMETER10("likes", "作品点赞数"),
    PARAMETER11("shares", "作品分享数"),
    PARAMETER12("comments", "作品评论数"),
    PARAMETER13("play3sCount", "作品3秒播放数"),
    PARAMETER14("eventAppointSuccess", "预约成功数"),
    PARAMETER15("liveWatchCount", "直播观看数"),
    PARAMETER16("liveOrderCount", "直接订单数"),
    PARAMETER17("liveGmv", "直接GMV"),
    PARAMETER18("liveRoi", "直接ROI"),
    PARAMETER19("liveFans", "涨粉数"),
    PARAMETER20("liveNextDayFans", "次日涨粉留存数"),
    PARAMETER21("liveNextDayFansRoi", "次日涨粉留存率"),
    PARAMETER22("liveFans7d", "7日涨粉留存数"),
    PARAMETER23("liveFans7dRoi", "7日涨粉留存率"),
    PARAMETER24("liveFans15d", "15日涨粉留存数"),
    PARAMETER25("liveFans15dRoi", "15日涨粉留存率");

    private String code;
    private String name;

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

    public static String getCodeByName(String name) {
        for (MaterialEnum material : MaterialEnum.values()) {
            if (material.getName().equals(name)) {
                return material.getCode();
            }
        }
        return "";
    }
    public static String getNameByCode(String code) {
        for (MaterialEnum material : MaterialEnum.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 (MaterialEnum material : MaterialEnum.values()) {
            map.put(material.getName(), material.getCode());
        }
        return map;
    }
}
