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

import cn.hutool.core.util.ArrayUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

import java.util.Objects;

@AllArgsConstructor
@Getter
public enum CustomDraweeEnum {

    freight("freight", "运费", "freight",1),

    clearanceFee("clearanceFee", "清关费", "Custom Clearance",2),

    cartonPackingFee("cartonPackingFee","纸箱打包费","Carton packaging fee",3),

    woodenFramePackingeFee("woodenFramePackingeFee","木架打包费","Wooden frame packaging fee",4),
    customsDeclarationFee("customsDeclarationFee", "报关费", "customs charges",5),

    premium("premium", "保价费", "Insurance fee",6),

    forkliftFee("forkliftFee","叉车费","Forklift fees",7),

    innerTransFee("inlandTransportationFee","内陆运输费","Inland transportation fees",8),

    beatWoodenPallets("beatWoodenPallets","木托打包费","Wooden pallet packaging fee",9),

    box("box","木箱打包费","Wooden box packaging fee",10),

    bagged("bagged","袋装打包费","Bag packaging fee",11),

    flightCase("flightCase","航空箱费用","Air box cost",12),

    unloadingFee("unloadingFee","卸货费","landing charge",13),

    documentDeclarationFee("documentDeclarationFee","单证报关费","Document customs declaration fee",14),

    warehouseRent("warehouseRent","仓租费","Warehouse rental fee",15),

    // TODO 待补充...

    otherFee("otherFee", "其他费用", "other expenses",0),

    ;
    /**
     * 对应自定义付款人类型中的name值
     */
    private final String key;


    private final String name;
    private final String nameEn;

    /**
     * 对应应收单feeType的类型  (注: -1 为未定义的)
     */
    private final Integer value;

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


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


}
