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

import cn.hutool.core.util.ArrayUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

@AllArgsConstructor
@Getter
public enum OrderApprovalTypeEnum {
    DISCOUNT_APPLY(1, "优惠申请"),
    ADMIN_DISCOUNT(2, "管理优惠"),
    COMMISSION_SET(3, "佣金设置"),
    WEIGHT_DISCOUNT(4, "重货优惠"),
    BUBBLE_DISCOUNT(5, "泡货优惠"),
    ORDER_SPLIT(6, "拆单"),
    ORDER_CARGO_CONTROL_PICK_UPDATE(7, "控货订单放货修改"),
    ORDER_CARGO_CONTROL_PICK_ANTI_CHECKING(8, "控货订单反复核"),
    seasoning_condiments(9, "调货"),
    order_cargo_control_cancel_pick(10, "取消放货"),
    merge_order(11, "合单"),
    expense_apply(12, "费用申请"),
    WAREHOUSE_ADJUST(13, "调仓"),
    ORDER_UPDATE(14, "订单修改"),
    WAREHOUSE_UPDATE(22, "入仓修改"),
    WAREHOUSE_ROLLBACK(23, "退仓"),
    
    pre_install_back(24, "预装反审"),
    closure_back(25, "封柜反审"),
    unloading_cabinet_back(26, "卸柜反审"),
    customs_exit(27, "报关审批"),
    ORDER_SPLIT_REVOKE(28, "撤销订单拆单"),
    BUBBLE_WEIGHT_SPECIAL_DISCOUNT(29, "泡重特价优惠"),

    DISCOUNT_APPLY_BATCH(31, "批量优惠申请"),
    ADMIN_DISCOUNT_BATCH(32, "批量管理折扣申请"),

    //分拣
    sorting(50, "分拣审批"),

    //分拣反审
    sorting_back(51,"分拣反审"),

    //到仓
    warehoused(52, "到仓审批"),

    //到仓反审
    warehoused_back(53, "到仓反审"),

    ;

    public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(OrderApprovalTypeEnum::getValue).toArray();
    /**
     * 类型
     */
    private final Integer value;
    /**
     * 类型名
     */
    private final String name;

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

}
