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 OrderStatusEnum implements IntArrayValuable {
    DRAFT(0, "草稿", "draft", "",""),
    //1未使用
    ORDER_PLACED(2, "已下单", "Order placed", "",""),
    WAREHOUSING(3, "入仓中", "Warehousing in progress", "",""),
//    SPECIAL_APPLY_PROGRESS(4, "特价申请中", "Special offer application in progress", "",""),
    IN_WAREHOUSE(5, "已入仓", "Warehousing", "货物已入捷道%s","The shipment has been delivered to E&C %s"),
    WITHDRAWN_EXPENSES_NOT_CLEARED(6, "已退仓-费用未清", "Withdrawn - expense not cleared", "",""),
    WITHDRAWN(7, "已退仓", "Withdrawn", "",""),
    WAREHOUSE_ADJUSTMENT(8, "调仓中", "Warehouse adjustment in progress", "",""),
    MERGED_ORDER(9, "已合单", "Closed order", "",""),
    SPLIT_ORDER(10, "已拆单", "Split order", "",""),
    PRE_INSTALLED(11, "已预装", "Pre installed", "",""),
    INSTALLED_CABINET(12, "已装柜", "Installed cabinet", "预计开船时间：","Estimated time of departure:"),
    IN_SHIPPING(13, "航运中", "In shipping", "货物已出仓，预计到港时间：","The goods have been warehoused, and the estimated arrival time is:"),

    ARRIVED(14, "已到目的港", "Arrived", "",""),
    CLEARED(15, "已清关", "Cleared", "货物已清关","The shipment been cleared out"),
    UNLOADED_CABINET(16, "已卸柜", "Unloaded cabinet", "",""),
    TWP_WAY_TAKEOFF(17, "二程起飞", "Two way takeoff", "",""),
    TWP_WAY_ARRIVAL(18, "二程到目的港", "Two way arrival", "",""),
//    WRITTEN_OFF(19, "已核销", "Written off"),
    PICKED_UP(20, "已提货", "Picked up", "提货时间：","Pickup time:"),
    PART_PICKED_UP(21, "部分提货", "Part Picked up", "提货时间：","Pickup time:"),

    //....预留定义
//    TALLY(31, "理货", "tally", "", ""),
    SHIPMENT(32, "出货", "shipment", "", ""),


//    ORDER_UPDATE(50, "订单修改中", "Order update in progress", "",""),
    CANCEL(88, "取消订单", "cancellation of order", "",""),

    // 此状态为状态13的空运转义状态，当运输方式为空运时，状态13为已起飞
    HAS_TAKEN_OFF(130, "已起飞", "Has taken off", "货物已起飞，预计在%s日期抵达%s机场","The shipment has departed China.ETA date to %s is %s"),
    CUSTOMS_PASS_AIR(12421, "已报关", "Customs Declaration", "货物报关已放行，候机中","Shipment been released by China custom.waiting to departed China"),
    CUSTOMS_PART_EXIT(12322, "已报关", "Customs Inspection", "报关查验退场，返回仓库中","Shipment been Inspected by China custom.waiting return to warehouse"),
    CUSTOMS_FULL_EXIT(12323, "已报关", "Customs Inspection", "报关查验退场，返回仓库中","Shipment been Inspected by China custom.waiting return to warehouse"),
    WAREHOUSED(32412,"出仓", "Sent out","",""),
    UNLOADED_CABINET_AIR(16435,"到仓", "Location","货物已抵达捷道%s提货仓","The shipment been delivered at E&C %s branch"),

    ;


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

    /**
     * 类型
     */
    private final Integer value;
    /**
     * 类型中文名
     */
    private final String nameZh;

    /**
     * 类型英文名
     */
    private final String nameEn;

    /**
     * 备注中文名
     */
    private final String remarksZh;

    /**
     * 备注英文名
     */
    private final String remarksEn;



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

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

}
