package com.zm.order.tool.server.constants;

import com.google.common.collect.Lists;
import com.zm.order.tool.server.enums.BizTypeEnum;
import com.zm.order.tool.server.enums.OrderItemTypeEnum;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Description 通用常量
 * @Author: ph
 * @Date: 2019/11/15 14:37
 */
public class CommonConstants {
    /**
     * 存在退款单确认信息
     */
    public static final int REFUND_CONFIRM = 1;
    /**
     * 订单逻辑表名称
     */
    public static final String LOGIC_TABLE_ORDER = "orders";
    /**
     * 多人点餐
     * orderSubType = 1
     */
    public static final int MULTI_USER_ORDER = 1;

    /**
     * 多人点餐主订单id
     */
    public static final String MASTER_ID = "masterId";

    /**
     * 单个订单多个参与者
     * 多条订单号相同的记录，用户id不同
     */
    public static final List<Integer> MULTI_USER_ORDER_LIST = Lists.newArrayList(1, 2);

    /**
     * 是否包含三方单扩展信息
     */
    public static final String IS_THIRD_EXTRA = "isThirdExtra";

    /**
     * 订单商品逻辑表名称
     */
    public static final String LOGIC_TABLE_ORDER_ITEM = "order_items";
    /**
     * 支付明细上限标记
     */
    public static final String PAY_FLAG = "PF";

    /**
     * 收货人手机号
     */
    public static final String RECEIVER_MOBILE = "receiverMobile";

    /**
     * 订单优惠逻辑表名称
     */
    public static final String LOGIC_TABLE_ORDER_DISCOUNT = "order_discounts";

    public static final String LOGIC_TABLE_ORDER_PAY_DETAILS = "order_pay_details";

    public static final String LOGIC_TABLE_ORDER_ADDRESS = "order_addresses";
    public static final String LOGIC_TABLE_ORDER_ITEM_BATCHING = "order_item_batching";
    public static final String LOGIC_TABLE_ORDER_SELF_TAKE = "order_self_take";
    public static final String LOGIC_TABLE_ORDER_EXTENDS = "order_extends";
    public static final String LOGIC_TABLE_ORDER_COMMENT = "order_comment";
    public static final String LOGIC_TABLE_ORDER_ITEM_COMMENT = "order_item_comment";

    /**
     * 订单号索引逻辑表名称
     */
    public static final String LOGIC_TABLE_ORDER_INDEX = "order_index";

    /**
     * 订单操作逻辑表名称
     */
    public static final String  LOGIC_TABLE_ORDER_OPERATIONS ="order_operations";

    /**
     * 订单推送日志表
     */
    public static final String  LOGIC_TABLE_ORDER_PUSH_LOGS ="order_push_logs";

    /**
     * 最大查询数量
     */
    public static final Integer MAX_QUERY_COUNT = 100000;

    /**
     * es查询最大偏移量
     */
    public static final Integer MAX_OFFSET_COUNT = 100000;

    public static final Long EXIT_TIME = 1646348400000L;

    //3-01 号
//    public static final Long TEMP_LAST_ID = 1102383890000736257L;

    //4-01 号
    public static final Long TEMP_LAST_ID = 1112893137802248193L;

    /**
     * 分片分隔符
     */
    public static final String SHARDING_SPLIT = "_";


    public static final Integer MAX_ITEM_SIZE = 10;

    public static final String ITEM_FLAG = "TL";

    /**
     * 优惠上限标记
     */
    public static final String DISCOUNT_FLAG = "DF";

    /**
     * 退款完成标记
     */
    public static final Integer REFUND_COMPLETED_FLAG = 1;

    /**
     * 地址的扩展信息组
     */
    public static final String ADDR_EXTRA_GROUP = "addr";

    /**
      * es 数据过期天数
     **/
    public static final Integer DAYS_OF_ES_OVER_TIME = 366;

    /**
      * 删除ES数据每批次大小
     **/
    public static final Integer BATCH_SIZE_OF_DEL = 1000;

    /**
     * 多人点餐的业务线
     **/
    public static final List<Integer> MULTI_BIZ_TYPES = new ArrayList<Integer>(2){{
        add(BizTypeEnum.CY.getType());
        add(BizTypeEnum.CATERING.getType());
    }};

    /**
     * 直接显示的商品类型
     **/
    public static final Map<Integer, Integer> SHOW_ITEM_TYPES = new HashMap<Integer, Integer>(){{
        put(null, 1);
        put(OrderItemTypeEnum.COMMON_ITEM.getCode(), 1);
        put(OrderItemTypeEnum.COUPON_ITEM.getCode(), 1);
        put(OrderItemTypeEnum.THIRD_RIGHTS_GOODS.getCode(), 1);
        put(OrderItemTypeEnum.COUPON_BAG_GOODS.getCode(), 1);
        put(OrderItemTypeEnum.PAID_EQUITY_CARD_GOODS.getCode(), 1);
    }};


    /**
     * 烘焙多人点餐
     * 子订单类型 orderSubType
     */
    public static final Integer BAKING_MULTIPLE_USER = 3;

    public static final Integer INSERT_LIMIT = 200;

    /**
     * 对应es索引名称：new_order
     *
     * kafka消息推送topic
     */
    public static final String ES_NEW_ORDER_INDEX = "order_center_order_topic";

    /**
     * 对应es索引名称：order
     *
     * kafka消息推送topic
     */
    public static final String ES_NEW_INDEX_TOPIC = "order_center_orders_topic";

    /**
     * 对应es索引名称：order_amount
     *
     * kafka消息推送topic
     */
    public static final String ES_ORDER_AMOUNT_INDEX = "order_center_amount_topic";

    /**
     * 对应es索引名称：comment
     *
     * kafka消息推送topic
     */
    public static final String ES_ORDER_COMMENT_INDEX = "order_center_comment_topic";

    /**
     * 对应es索引名称：comment
     * 订单标准化需求中，创建新的topic名称
     *
     * kafka消息推送topic
     */
    public static final String ES_ORDER_COMMENTS_INDEX = "order_center_comments_topic";

    /**
     * 对应es索引名称：refund
     *
     * kafka消息推送topic
     */
    public static final String ORDER_CENTER_REFUND_TOPIC = "order_center_refund_topic";

    /**
     * 对应es索引名称：refund
     * 订单标准化需求中，创建新的topic名称
     *
     * kafka消息推送topic
     */
    public static final String ORDER_CENTER_REFUNDS_TOPIC = "order_center_refunds_topic";

    /**
     * 商家升级配置
     *
     * 1-品牌已切换标准化版本
     * 0或没有配置，表示未切换的老版本
     */
    public static final String SELLER_UPGRADE_CONFIG = "Order-center.Data-standardization.Version";


    /**
     * es索引所有分片
     * -1代表走base索引
     */
    public static final List<Long> INDEX_ROUTES = Lists.newArrayList(49006L, 201424L, 203009L, 210286L, 209042L, 204102L, 50161L, 27088L,
        203192L, 50324L, 214176L, 206954L, 206198L, 216359L, 211302L, 33750L, 214977L, 205169L, 209235L, 203683L, -1L);

    /**
     * 已经升级的商家列表
     */
    public static final List<Long> UPGRADE_SELLER_LIST = Lists.newArrayList(
            205387L, 213951L, 203548L, 218668L, 202565L, 217386L);
}
