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

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

/**
 * 直播数据——触达报表 字段枚举，
 * 用于锁定EXCEL顺序不同时的字段与数据的对应关系
 */
public enum TouchEnum {
    PARAMETER0("statDate", "时间"),
    PARAMETER1("fanStrat", "粉丝分层"),
    PARAMETER2("customerStrat", "客群分层"),
    PARAMETER3("charge", "花费(元)"),
    PARAMETER4("todayCumulativeGmv", "当日累计GMV"),
    PARAMETER5("todayCumulativeRoi", "当日累计ROI"),
    PARAMETER6("todayCumulativeOrderCount", "当日累计订单数"),
    PARAMETER7("showUsers", "曝光用户数"),
    PARAMETER8("buyUsers", "购买用户数"),
    PARAMETER9("buyRatio", "购买转化率"),
    PARAMETER10("arpu", "ARPU"),
    PARAMETER11("uv", "UV价值"),
    PARAMETER12("averagePrice", "单均价");

    private String code;
    private String name;

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

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