package cn.iocoder.yudao.module.order.enums;

import cn.hutool.core.util.ArrayUtil;
import cn.iocoder.yudao.framework.common.util.json.core.IntArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

@AllArgsConstructor
@Getter
public enum OrderAbnormalStateEnum implements IntArrayValuable {

    ORDER_NO_QUOTE_EXCEPTION("order_no_quote_exception", 1, "order.no.quote.exception"),//未报价 no quote
    ORDER_SUPERFLUOUS_BOX_EXCEPTION("order_superfluous_box_exception", 2, "order.superfluous.box.exception"),// 多箱
    ORDER_LACK_BOX_EXCEPTION("order_lack_box_exception", 3, "order.lack.box.exception"),// "少箱"
    ORDER_PAY_EXCEPTION("order_pay_exception", 4, "order.pay.exception"),//"产品需要预付运费"
    ORDER_MISS_EXCEPTION("order_miss_exception", 5, "order.miss.exception"),//"货物丢失"
    ORDER_SUPERFLUOUS_GOODS_EXCEPTION("order_superfluous_goods_exception", 6, "order.superfluous.goods.exception"),// "货物增多"
    ORDER_DAMAGE_EXCEPTION("order_damage_exception", 7, "order.damage.exception"),//"货物破损"
    ORDER_IN_WATER_EXCEPTION("order_in_water_exception", 8, "order.in.water.exception"),// "货物浸水"
    ORDER_HEAVY_CARGO_EXCEPTION("order_heavy_cargo_exception", 9, "order.heavy.cargo.exception"),// "重货异常"
    ORDER_BULKY_CARGO_EXCEPTION("order_bulky_cargo_exception", 10, "order.bulky.cargo.exception"),// "泡货异常"
    ORDER_DOC_EXCEPTION("order_doc_exception", 11, "order.doc.exception"),//"单证异常"
    ORDER_CONSIGNOR_EXCEPTION("order_consignor_exception", 12, "order.consignor.exception"),//"发货人异常"
    ORDER_COD_EXCEPTION("order_cod_exception", 13, "order.cod.exception"),//"代收货款"
    ORDER_OTHER_EXCEPTION("order_other_exception", 14, "order.other.exception"),//"其它异常"
    ORDER_PICK_UP_EXCEPTION("order_pick_up_exception", 15, "order.pick.up.exception"),//"提货异常"
    NOT_CUSTOMER_SERVICE_EXCEPTION("not_customer_service_exception", 16, "not.customer.service.exception"),//"未分配客户经理"
    GOODS_ADD_EXCEPTION("goods_add_exception", 17, "goods.add.exception"),//"新增商品异常“
    FEE_EXCEPTION("fee_exception", 18, "fee.exception"),//"费用异常“


    //--------------------2.0空运新增-start---------------
    CUSTOMS_FEE_NOT_QUOTE_EXCEPTION("customs_fee_not_quote_exception", 19, "customs.fee.not.quote.exception"), // 清关费未报价异常
    GOODS_OVERWEIGHT_EXCEPTION("overweight_exception", 20, "goods.overweight.exception"), // 商品重量超限异常
    NOT_SHIPPING_CHANNEL_EXCEPTION("not_shipping_channel_exception", 21, "not.shipping.channel.exception"),// 不可出渠道异常
    GOODS_WEIGHT_EXCEPTION("goods_weight_exception", 22, "goods.weight.exception"),// 重量异常
    IN_WAREHOUSING_DIFF_EXCEPTION("in_warehousing_diff_exception", 23, "in.warehousing.diff.exception"), // 入仓特性不符异常
    STOCK_UP_EXCEPTION("stock_up_exception", 24, "stock.up.exception"),// 备货异常
    CHANNEL_EXCEPTION("channel_exception", 25, "channel.exception"),// 渠道异常

    CHANNEL_PACKAGING_OVERWEIGHT_EXCEPTION("channel_packaging_overweight_exception", 26, "channel.packaging.overweight.exception"), // 渠道包装重量超限异常
    LINE_LOOP_EXCEPTION("line_loop_exception", 27, "line.loop.exception"),// 单询异常


    LINE_WEIGHT_EXCEPTION("line_weight_exception", 28, "line.weight.exception"), // 路线重量超限异常
    //....预留

    MULTIPLE_EXCEPTION("multiple_exception", 99, "order.multiple.exceptions"),//"多个异常"
    ;
    public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(OrderAbnormalStateEnum::getValue).toArray();
    private final String key;

    private final Integer value;

    private final String desc;

    public static OrderAbnormalStateEnum valueOf(Integer value) {
        return ArrayUtil.firstMatch(abnormalState -> abnormalState.getValue().equals(value), OrderAbnormalStateEnum.values());
    }

    public static OrderAbnormalStateEnum keyOf(String key) {
        return ArrayUtil.firstMatch(abnormalState -> abnormalState.getKey().equals(key), OrderAbnormalStateEnum.values());
    }

    @Override
    public int[] array() {
        return ARRAYS;
    }
}
