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

/**
 * 运营盯盘 按字段排序枚举
 *
 * @param
 * @author ZHAOXA
 * @return
 * @throws
 */
public enum CheckParametersCostEnum {
    PARAMETER1("cost", "sum(t1.charge)"),
    PARAMETER2("photoShow", "sum(t1.photo_show)"),
    PARAMETER3("photoClick", "sum(t1.photo_click)"),
    PARAMETER4("aClick", "sum(t1.aclick)"),
    PARAMETER5("bClick", "sum(t1.bclick)"),
    PARAMETER6("cpm", "sum(t1.charge) / sum(t1.photo_show)"),
    PARAMETER7("cpc", "sum(t1.charge) / sum(t1.photo_click)"),
    PARAMETER8("cpb", "sum(t1.charge) / sum(t1.bclick)"),
    PARAMETER9("downloadStart", "sum(download_started)"),
    PARAMETER10("downloadStartCost", "sum(t1.charge) / sum(t1.download_started)"),
    PARAMETER11("downloadFinish", "sum(download_completed)"),
    PARAMETER12("downloadFinishCost", "sum(t1.charge) / sum(t1.download_completed)"),
    PARAMETER13("active", "sum(activation)"),
    PARAMETER14("activeCost", "sum(t1.charge) / sum(t1.activation)"),
    PARAMETER15("firstDayPay", "sum(t1.event_pay_first_day)"),
    PARAMETER16("firstDayPayAmount", "sum(t1.event_pay_purchase_amount_first_day)"),
    PARAMETER17("firstDayPayCost", "sum(t1.charge) / sum(t1.event_pay_first_day)"),
    PARAMETER18("eventPay", "sum(t1.event_pay)"),
    PARAMETER19("eventPayPurchaseAmount", "sum(t1.event_pay_purchase_amount)"),
    PARAMETER20("eventPayCost", "sum(t1.charge) / sum(t1.event_pay)"),
    PARAMETER21("register", "sum(t1.event_register)"),
    PARAMETER22("activeRegisterCost", "sum(t1.charge)/sum(t1.event_register)"),
    PARAMETER23("eventJinJianApp", "sum(event_jin_jian_app)"),
    PARAMETER24("eventJinJianAppCost", "sum(t1.charge)/sum(t1.event_jin_jian_app)"),
    PARAMETER25("eventCreditGrantApp", "sum(event_credit_grant_app)"),
    PARAMETER26("eventCreditGrantAppCost", "sum(t1.charge)/sum(t1.event_credit_grant_app)"),
    PARAMETER27("formCount", "sum(t1.form_count)"),
    PARAMETER28("formCountCost", "sum(t1.charge)/sum(t1.form_count)"),
    PARAMETER29("nextDayOpen", "sum(t1.event_next_day_stay)"),
    PARAMETER30("nextDayOpenCost", "sum(t1.charge)/sum(t1.event_next_day_stay)"),
    PARAMETER31("eventJinJianLandingPage", "sum(t1.event_jin_jian_landing_page)"),
    PARAMETER32("eventJinJianLandingPageCost", "sum(t1.charge)/sum(t1.event_jin_jian_landing_page)"),
    PARAMETER33("eventCreditGrantLandingPage", "sum(t1.event_credit_grant_landing_page)"),
    PARAMETER34("eventCreditGrantLandingPageCost", "sum(t1.charge)/sum(t1.event_credit_grant_landing_page)"),
    PARAMETER35("submit", "sum(t1.submit)"),
    PARAMETER36("submitCost", "sum(t1.charge)/sum(t1.submit)"),
    PARAMETER37("totalBalance", "balance"),
    PARAMETER38("budget", "day_budget");

    private String value;
    private String formula;

    CheckParametersCostEnum(String value, String formula) {
        this.value = value;
        this.formula = formula;
    }

    public static String getFormula(String value) {
        for (CheckParametersCostEnum campaignType : CheckParametersCostEnum.values()) {
            if (campaignType.getValue().equals(value)) {
                return campaignType.getFormula();
            }
        }
        return "";
    }

    public static boolean isInclude(String key) {
        boolean include = false;
        for (CheckParametersCostEnum e : CheckParametersCostEnum.values()) {
            if (e.getValue().equals(key)) {
                include = true;
                break;
            }
        }
        return include;
    }

    public String getValue() {
        return value;
    }

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

    public String getFormula() {
        return formula;
    }

    public void setFormula(String formula) {
        this.formula = formula;
    }
}
