package com.ningdatech.carapi.report.constant;

import java.util.Objects;

import org.apache.commons.lang3.StringUtils;

import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

/**
 * 直报系统上报数据类型
 * @return
 * @author CMM
 * @since 2023/02/07 13:55
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "UploadDataTypeEnum", description = "直报系统上报数据类型-枚举")
public enum UploadDataTypeEnum {

    /**
     * 散装水泥供应量快报
     */
    BULK_CEMENT_SUPPLY_BULLETIN(1,"散装水泥供应量快报"),

    /**
     * 中转库进出量快报
     */
    BULK_CEMENT_TRANSFER_BULLETIN(2, "中转库进出量快报"),

    /**
     * 温台舟使用量快报
     */
    BULK_CEMENT_THREE_CITY_USAGE_BULLETIN(3,"温台舟使用量快报"),

    /**
     * 混凝土供应量快报
     */
    CONCRETE_SUPPLY_BULLETIN(4,"混凝土供应量快报"),

    /**
     * 砂浆供应量快报
     */
    MORTAR_SUPPLY_BULLETIN(5,"砂浆供应量快报"),

    /**
     * 非禁现区域散装水泥销售使用情况统计年报表
     */
    NON_PROHIBITED_AREAS_BULK_CEMENT_SALES_USE(6,"非禁现区域散装水泥销售使用情况统计年报表"),

    /**
     * 散装水泥物流设施统计年报表
     */
    BULK_CEMENT_LOGISTIC_FACILITY_STATISTIC_ANNUAL_REPORT(7,"散装水泥物流设施统计年报表"),

    /**
     * 生产材料物流装备统计年报表
     */
    MATERIAL_LOGISTIC_EQUIPMENT_STATISTIC_ANNUAL_REPORT(8,"生产材料物流装备统计年报表");

    private Integer code;
    private String desc;


    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static String getDescByCode(int code) {
        if(Objects.isNull(code)){
            return StringUtils.EMPTY;
        }
        for (UploadDataTypeEnum t : UploadDataTypeEnum.values()) {
            if (code == t.getCode()) {
                return t.desc;
            }
        }
        return StringUtils.EMPTY;
    }

    public boolean eq(String val) {
        return this.name().equals(val);
    }

}
