package cn.superdesk.uniorder.common.enums.common;

import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;

/**
 * @Description: 楼闪送 特殊费用Id
 * @Author: linjinyu
 * @CreateDate: 2021/4/23 下午3:59
 * @UpdateUser: linjinyu
 * @UpdateDate: 2021/4/23 下午3:59
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
public enum CommonOrderGoodsIdEnum {


	/****************************************** 商城部分 - 目标为共用 start ******************************************/

	退单退运费(-1L, "退单退运费"), // SELECT * FROM unified_order_goods WHERE goods_id = -1 AND goods_name != '退单退运费'
	商户承担运费(1L, "商户承担运费"), // SELECT * FROM unified_order_goods WHERE goods_id = 1 AND goods_name != '商户承担运费'
	运费(0L, "运费"), // SELECT * FROM unified_order_goods WHERE goods_id = 0 AND goods_name != '运费'

	/****************************************** 商城部分 - 目标为共用   end ******************************************/


	/****************************************** 服务之窗 - 楼闪送 start ******************************************/

//  用户配送费:用户支付的费用;
//  打包费:用户打包的费用;
//  商户配送费:商户需要支付给运营商的配送费,运营商与商户结算时需减掉商户配送费;
//  配送员配送费:配送员配送费用,商户与配送员结算;

//  青章银 mark by linjinyu 202105181139
//	总金额 = 商品销售总和 + 打包费 + 配送费
//	orderAmount = sellingAmount  + packingAmount + transportAmountVirt

	用户配送费(4001L, "用户配送费"),
	打包费(4002L, "打包费"),
	商户配送费(4003L, "商户配送费"),
	配送员配送费(4004L, "配送员配送费"),

	/****************************************** 服务之窗 - 楼闪送   end ******************************************/
	;

	private Long   key;
	private String desc;

	CommonOrderGoodsIdEnum(Long key, String desc) {
		this.key = key;
		this.desc = desc;
	}

	public Long getKey() {
		return key;
	}

	public String getDesc() {
		return desc;
	}

	public static String getDesc(Long key) {

		for (CommonOrderGoodsIdEnum c : CommonOrderGoodsIdEnum.values()) {
			if (c.key.equals(key)) {
				return c.getDesc();
			}
		}

		return "UNKNOW";

	}

	private static final Map<Long, CommonOrderGoodsIdEnum> LOOKUP = new HashMap<>();

	static {
		for (CommonOrderGoodsIdEnum s : EnumSet.allOf(CommonOrderGoodsIdEnum.class)) {
			LOOKUP.put(s.getKey(), s);
		}
	}

	public static CommonOrderGoodsIdEnum get(Long key) {
		return LOOKUP.get(key);
	}

}
