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","Brouillon" ,"","",""),
    //1未使用
    ORDER_PLACED(2, "已下单", "Order placed","Commande passée", "","",""),
    WAREHOUSING(3, "入仓中", "Warehousing in progress","Stockage en cours", "","",""),
//    SPECIAL_APPLY_PROGRESS(4, "特价申请中", "Special offer application in progress", "",""),
    IN_WAREHOUSE(5, "已入仓", "Received","Reçu", "货物已入捷道%s"," %s ctns have been received at E&C %s warehouse,TTL ctns are %s.","%s colis ont été reçus à l'entrepôt E&C %s,total est  %s."),
    WITHDRAWN_EXPENSES_NOT_CLEARED(6, "已退仓-费用未清", "Returned -unpaid","Retourné - impayé", "","",""),
    WITHDRAWN(7, "已退仓", "Returned","Retourné", "","",""),
    WAREHOUSE_ADJUSTMENT(8, "调仓中", "Transfer in progress","Transfert en cours", "","",""),
    MERGED_ORDER(9, "已合单", "Merge order","Fusionner la commande", "","",""),
    SPLIT_ORDER(10, "已拆单", "Split order","Diviser la commande", "","",""),
    PRE_INSTALLED(11, "已预装", "Preloaded","Préchargé", "","",""),
    INSTALLED_CABINET(12, "已装柜", "Loaded","Chargé", "预计开船时间：","ETD:","ETD (Date estimée de départ):"),
    IN_SHIPPING(13, "航运中", "Shipping","Expédition", "货物已出仓，预计到港时间：","Vessel departured and ETA:","déja quitté le port. ETA (Date environ d'arrivée) :"),

    ARRIVED(14, "已到目的港", "Arrived","Arrivé", "","",""),
    CLEARED(15, "已清关", "Cleared out","Dédouané", "货物已清关","Customs clearance of the goods has been completed","les produits ont déja dédouané."),
    UNLOADED_CABINET(16, "已卸柜", "Unloaded","Déchargé", "","",""),
    TWP_WAY_TAKEOFF(17, "二程起飞", "departed from transit station","Départ de la station de transit", "","",""),
    TWP_WAY_ARRIVAL(18, "二程到目的港", "Arrived destination","Arrivé à destination", "","",""),
//    WRITTEN_OFF(19, "已核销", "Written off"),
    PICKED_UP(20, "已提货", "Collected","Retiré", "提货时间：","Pick-up time:","Heure de retiré :"),
    PART_PICKED_UP(21, "部分提货", "Parts Collected","retiré partiellement", "提货时间：","Pick-up time:","Heure de retiré :"),

    //....预留定义
//    TALLY(31, "理货", "tally", "", ""),
    SHIPMENT(32, "出货", "Sent out","Envoyé", "", "", ""),


//    ORDER_UPDATE(50, "订单修改中", "Order update in progress", "",""),
    CANCEL(88, "取消订单", "Order Cancelled", "Commande annulée", "","", ""),

    // 此状态为状态13的空运转义状态，当运输方式为空运时，状态13为已起飞
    HAS_TAKEN_OFF(130, "已起飞", "Departed", "Expédié", "货物已起飞，预计在%s日期抵达%s机场","The goods has departed China .ETA date to %s is %s","Les marchandises ont quitté la Chine. ETA à %s est %s."),
    CUSTOMS_PASS_AIR(12421, "已报关", "Customs Declaration", "déja déclaré", "货物报关已放行，候机中","Goods been released by China custom.waiting to departed China","Les marchandises ont été libérées par la douane chinoise, en attente de départ."),
    CUSTOMS_PART_EXIT(12322, "已报关", "Customs Inspection", "déja déclaré", "报关查验退场，返回仓库中","Goods been Inspected by China custom.waiting return to warehouse","Les marchandises ont été inspectées par la douane chinoise, en attente de retour à l'entrepôt."),
    CUSTOMS_FULL_EXIT(12323, "已报关", "Customs Inspection", "déja déclaré", "报关查验退场，返回仓库中","Goods been Inspected by China custom.waiting return to warehouse","Les marchandises ont été libérées par la douane chinoise, en attente de retour à l'entrepôt."),
    WAREHOUSED(32412,"出仓", "Dispatched", "Expédié","","", ""),
    UNLOADED_CABINET_AIR(16435,"到仓", "Arrived", "Arrivé","货物已抵达捷道%s提货仓","The goods has been delivered to E&C%s  branch.","Les marchandises ont été livrées à la branche E&C %s."),

    ;


    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 nameFr;

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

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

    /**
     * 备注法文名
     */
    private final String remarksFr;



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

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

}
