package com.tzld.piaoquan.ad.engine.commons.enums;

/**
 * 人群分层枚举
 */
public enum CrowdLayerEnum {


    NO_EXPOSURE(1, "无曝光"),
    WITH_EXPOSURE_NO_CLICK(2, "有曝光无点击"),
    WITH_CLICK_NO_CONVERSION(3, "有点击无转化"),
    WITH_CONVERSION(4, "有转化"),
    ;
    private Integer code;
    private String desc;

    CrowdLayerEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static CrowdLayerEnum getByCode(Integer code) {
        if (code == null) {
            return null;
        }
        for (CrowdLayerEnum constants : values()) {
            if (constants.getCode().equals(code)) {
                return constants;
            }
        }
        return null;
    }

    public static CrowdLayerEnum getBytDesc( String desc) {
        if (desc == null) {
            return null;
        }
        for (CrowdLayerEnum constants : values()) {
            if (constants.getDesc().equals(desc)) {
                return constants;
            }
        }
        return null;
    }

}
