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 OrderApprovalTypeResultEnum  implements IntArrayValuable {
    discount_processing(1,1, "discount.processing"),
    discount_pass(1,2, "discount.pass"),
    discount_reject(1,3, "discount.reject"),
    discount_cancel(1,4, "discount.cancel"),

    admin_discount_processing(2,1, "admin.discount.processing"),
    admin_discount_pass(2,2, "admin.discount.pass"),
    admin_discount_reject(2,3, "admin.discount.reject"),
    admin_discount_cancel(2,4, "admin.discount.cancel"),

    commission_set_processing(3,1, "commission.set.processing"),
    commission_set_pass(3,2, "commission.set.pass"),
    commission_set_reject(3,3, "commission.set.reject"),
    commission_set_cancel(3,4, "commission.set.cancel"),

    weight_discount_processing(4,1, "weight.discount.processing"),
    weight_discount_pass(4,2, "weight.discount.pass"),
    weight_discount_reject(4,3, "weight.discount.reject"),
    weight_discount_cancel(4,4, "weight.discount.cancel"),

    bubble_discount_processing(5,1, "bubble.discount.processing"),
    bubble_discount_pass(5,2, "bubble.discount.pass"),
    bubble_discount_reject(5,3, "bubble.discount.reject"),
    bubble_discount_cancel(5,4, "bubble.discount.cancel"),

    order_split_processing(6,1, "order.split.processing"),
    order_split_pass(6,2, "order.split.pass"),
    order_split_reject(6,3, "order.split.reject"),
    order_split_cancel(6,4, "order.split.cancel"),

    /**开始 --- 控货审核因为是并行条件，不用合并到订单状态中**/
    order_cargo_control_pick_update_processing(7,1, "order.cargo.control.pick.update.processing"),
    order_cargo_control_pick_update_pass(7,2, "order.cargo.control.pick.update.pass"),
    order_cargo_control_pick_update_reject(7,3, "order.cargo.control.pick.update.reject"),
    order_cargo_control_pick_update_cancel(7,4, "order.cargo.control.pick.update.cancel"),

    order_cargo_control_pick_anti_checking_processing(8,1, "order.cargo.control.pick.anti.checking.processing"),
    order_cargo_control_pick_anti_checking_pass(8,2, "order.cargo.control.pick.anti.checking.pass"),
    order_cargo_control_pick_anti_checking_reject(8,3, "order.cargo.control.pick.anti.checking.reject"),
    order_cargo_control_pick_anti_checking_cancel(8,4, "order.cargo.control.pick.anti.checking.cancel"),

    seasoning_condiments_processing(9,1, "seasoning.condiments.processing"),
    seasoning_condiments_pass(9,2, "seasoning.condiments.pass"),
    seasoning_condiments_reject(9,3, "seasoning.condiments.reject"),
    seasoning_condiments_cancel(9,4, "seasoning.condiments.cancel"),

    order_cargo_control_cancel_pick_processing(10,1, "order.cargo.control.cancel.pick.processing"),
    order_cargo_control_cancel_pick_pass(10,2, "order.cargo.control.cancel.pick.pass"),
    order_cargo_control_cancel_pick_reject(10,3, "order.cargo.control.cancel.pick.reject"),
    order_cargo_control_cancel_pick_cancel(10,4, "order.cargo.control.cancel.pick.cancel"),

    /**结束 --- 控货审核因为是并行条件，不用合并到订单状态中**/

    merge_order_processing(11,1, "order.merge.processing"),
    merge_order_pass(11,2, "order.merge.pass"),
    merge_order_reject(11,3, "order.merge.reject"),
    merge_order_cancel(11,4, "order.merge.cancel"),

    expense_apply_processing(12,1, "fee.application.processing"),
    expense_apply_pass(12,2, "fee.application.pass"),
    expense_apply_reject(12,3, "fee.application.reject"),
    expense_apply_cancel(12,4, "fee.application.cancel"),

    warehouse_adjust_processing(13,1, "warehouse.adjustment.processing"),
    warehouse_adjust_pass(13,2, "warehouse.adjustment.pass"),
    warehouse_adjust_reject(13,3, "warehouse.adjustment.reject"),
    warehouse_adjust_cancel(13,4, "warehouse.adjustment.cancel"),

    order_update_processing(14,1, "order.update.processing"),
    order_update_pass(14,2, "order.update.pass"),
    order_update_reject(14,3, "order.update.reject"),
    order_update_cancel(14,4, "order.update.cancel"),

    pre_install_processing(18,1, "shipment.preload.processing"),
    pre_install_pass(18,2, "shipment.preload.pass"),
    pre_install_reject(18,3, "shipment.preload.reject"),
    pre_install_cancel(18,4, "shipment.preload.cancel"),

    closure_processing(19,1, "shipment.cabinet.processing"),
    closure_pass(19,2, "shipment.cabinet.pass"),
    closure_reject(19,3, "shipment.cabinet.reject"),
    closure_cancel(19,4, "shipment.cabinet.cancel"),

    unloading_cabinet_processing(20,1, "shipment.unload.processing"),
    unloading_cabinet_pass(20,2, "shipment.unload.pass"),
    unloading_cabinet_reject(20,3, "shipment.unload.reject"),
    unloading_cabinet_cancel(20,4, "shipment.unload.cancel"),

    warehouse_update_processing(22,1, "warehouse.entry.processing"),
    warehouse_update_pass(22,2, "warehouse.entry.pass"),
    warehouse_update_reject(22,3, "warehouse.entry.reject"),
    warehouse_update_cancel(22,4, "warehouse.entry.cancel"),


    warehouse_rollback_processing(23,1, "warehouse.returning.processing"),
    warehouse_rollback_pass(23,2, "warehouse.returning.pass"),
    warehouse_rollback_reject(23,3, "warehouse.returning.reject"),
    warehouse_rollback_cancel(23,4, "warehouse.returning.cancel"),


    pre_install_back_processing(24,1, "shipment.preload.back.processing"),
    pre_install_back_pass(24,2, "shipment.preload.back.pass"),
    pre_install_back_reject(24,3, "shipment.preload.back.reject"),
    pre_install_back_cancel(24,4, "shipment.preload.back.cancel"),

    closure_back_processing(25,1, "shipment.cabinet.back.processing"),
    closure_back_pass(25,2, "shipment.cabinet.back.pass"),
    closure_back_reject(25,3, "shipment.cabinet.back.reject"),
    closure_back_cancel(25,4, "shipment.cabinet.back.cancel"),

    unloading_cabinet_back_processing(26,1, "shipment.unload.back.processing"),
    unloading_cabinet_back_pass(26,2, "shipment.unload.back.pass"),
    unloading_cabinet_back_reject(26,3, "shipment.unload.back.reject"),
    unloading_cabinet_back_cancel(26,4, "shipment.unload.back.cancel"),

    customs_exit_processing(27,1, "customs.exit.processing"),
    customs_exit_pass(27,2, "customs.exit.pass"),
    customs_exit_reject(27,3, "customs.exit.reject"),
    customs_exit_cancel(27,4, "customs.exit.cancel"),


    order_split_revoke_processing(28,1, "order.split.revoke.processing"),
    order_split_revoke_pass(28,2, "order.split.revoke.pass"),
    order_split_revoke_reject(28,3, "order.split.revoke.reject"),
    order_split_revoke_cancel(28,4, "order.split.revoke.cancel"),

    BUBBLE_WEIGHT_SPECIAL_DISCOUNT_PROCESSING(29,1, "bubble.weight.special.discount.processing"),
    BUBBLE_WEIGHT_SPECIAL_DISCOUNT_PASS(29,2, "bubble.weight.special.discount.pass"),
    BUBBLE_WEIGHT_SPECIAL_DISCOUNT_REJECT(29,3, "bubble.weight.special.discount.reject"),
    BUBBLE_WEIGHT_SPECIAL_DISCOUNT_CANCEL(29,4, "bubble.weight.special.discount.cancel"),


    //批量优惠申请
    discount_batch_processing(31,1, "discount.batch.processing"),
    discount_batch_pass(31,2, "discount.batch.pass"),
    discount_batch_reject(31,3, "discount.batch.reject"),
    discount_batch_cancel(31,4, "discount.batch.cancel"),
    //批量管理折扣
    admin_discount_batch_processing(32,1, "admin.discount.batch.processing"),
    admin_discount_batch_pass(32,2, "admin.discount.batch.pass"),
    admin_discount_batch_reject(32,3, "admin.discount.batch.reject"),
    admin_discount_batch_cancel(32,4, "admin.discount.batch.cancel"),


    //分拣
    sorting_processing(50,1, "shipment.sorting.processing"),
    sorting_pass(50,2, "shipment.sorting.pass"),
    sorting_reject(50,3, "shipment.sorting.reject"),
    sorting_cancel(50,4, "shipment.sorting.cancel"),

    //分拣反审
    sorting_back_processing(51,1, "shipment.sorting.back.processing"),
    sorting_back_pass(51,2, "shipment.sorting.back.pass"),
    sorting_back_reject(51,3, "shipment.sorting.back.reject"),
    sorting_back_cancel(51,4, "shipment.sorting.back.cancel"),

    //到仓
    warehoused_processing(52,1, "shipment.warehoused.processing"),
    warehoused_pass(52,2, "shipment.warehoused.pass"),
    warehoused_reject(52,3, "shipment.warehoused.reject"),
    warehoused_cancel(52,4, "shipment.warehoused.cancel"),

    //到仓反审
    warehoused_back_processing(53,1, "shipment.warehoused.back.processing"),
    warehoused_back_pass(53,2, "shipment.warehoused.back.pass"),
    warehoused_back_reject(53,3, "shipment.warehoused.back.reject"),
    warehoused_back_cancel(53,4, "shipment.warehoused.back.cancel"),


    //出货
    shipment_processing(54,1, "air.shipment.processing"),
    shipment_pass(54,2, "air.shipment.pass"),
    shipment_reject(54,3, "air.shipment.reject"),
    shipment_cancel(54,4, "air.shipment.cancel"),

    //出货反审
    shipment_back_processing(55,1, "air.shipment.back.processing"),
    shipment_back_pass(55,2, "air.shipment.back.pass"),
    shipment_back_reject(55,3, "air.shipment.back.reject"),
    shipment_back_cancel(55,4, "air.shipment.back.cancel"),


    //撤销清关
    clearance_back_processing(56,1, "air.clearance.back.processing"),
    clearance_back_pass(56,2, "air.clearance.back.pass"),
    clearance_back_reject(56,3, "air.clearance.back.reject"),
    clearance_back_cancel(56,4, "air.clearance.back.cancel"),

    //收货人限制修改
    CONSIGNEE_LIMIT_UPDATE_PROCESSING(61,1, "consignee.limit.update.processing"),
    CONSIGNEE_LIMIT_UPDATE_PASS(61,2, "consignee.limit.update.pass"),
    CONSIGNEE_LIMIT_UPDATE_REJECT(61,3, "consignee.limit.update.reject"),
    CONSIGNEE_LIMIT_UPDATE_CANCEL(61,4, "consignee.limit.update.cancel"),

    //海外仓修改
    OVERSEAS_WAREHOUSE_UPDATE_PROCESSING(62,1, "overseas.warehouse.update.processing"),
    OVERSEAS_WAREHOUSE_UPDATE_PASS(62,2, "overseas.warehouse.update.pass"),
    OVERSEAS_WAREHOUSE_UPDATE_REJECT(62,3, "overseas.warehouse.update.reject"),
    OVERSEAS_WAREHOUSE_UPDATE_CANCEL(62,4, "overseas.warehouse.update.cancel"),

            ;


    public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(OrderApprovalTypeResultEnum::getType).toArray();

    /**
     * 审核类型
     */
    private final Integer type;
    /**
     * 审核状态
     */
    private final Integer result;
    /**
     * 审核说明(国际化定义)
     */
    private final String desc;

    public static OrderApprovalTypeResultEnum typeAndResultOf(Integer type, Integer result) {
        return ArrayUtil.firstMatch(approvalTypeResult -> approvalTypeResult.getType().equals(type) && approvalTypeResult.getResult().equals(result), OrderApprovalTypeResultEnum.values());
    }

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