package com.yc.ship.module.trade.enums;

import com.yc.ship.framework.common.enums.RpcConstants;

/**
 * API 相关的枚举
 *
 * @author 智胜慧旅
 */
public class ApiConstants {



    public static final String VERSION = "1.0.0";
    public static final String REDIS_KEY_TRADE_OTA_INFO = "trade_ota_info";

    public static final String SUCCESS = "success";
    public static final String ERROR = "error";

    /**
     * 服务名
     *
     * 注意，需要保证和 spring.application.name 保持一致
     */
    public static final String NAME = "travelhub-ops-trade-server";

    public static final String PREFIX = RpcConstants.RPC_API_PREFIX +  "/trade";

    /**
     * 初始
     */
    public static final int INIT = 0;
    /**
     * 失败
     */
    public static final int FAIL = 2;
    /**
     * 正常退款
     */
    public static final int REFUND_METHOD_NORMAL = 0;
    /**
     * 强制退款
     */
    public static final int REFUND_METHOD_FORCE = 1;
    /**
     * 改签退款
     */
    public static final int REFUND_METHOD_CHANGE_ORDER = 2;
    /**
     * 二次确认订单退款
     */
    public static final int REFUND_METHOD_CONFIRM_ORDER = 3;
    /**
     * 过期自动退款
     */
    public static final int REFUND_METHOD_OVERDUE_ORDER = 4;

    /**
     * 退单
     */
    public static final int REFUND_TYPE_ORDER = 0;
    /**
     * 退票
     */
    public static final int REFUND_TYPE_ITEM = 1;
    /**
     * 退票基础
     */
    public static final int REFUND_TYPE_ITEM_BASE = 2;
    /**
     * 供应商重试业务类型
     */
    public static final int SUPPLIER_RETRY_TYPE_ORDER = 0;
    public static final int SUPPLIER_RETRY_TYPE_PAY = 1;
    public static final int SUPPLIER_RETRY_TYPE_REFUND = 2;
    /**
     * 订单关联类型 主订单
     */
    public static final int ORDER_BIND_TYPE_MAIN = 0;
    /**
     * 订单关联类型 被关联订单
     */
    public static final int ORDER_BIND_TYPE_ASSOCIATED = 1;


    /**
     * 退款方式 0原路退款
     */
    public static final int REFUND_BACK_TYPE_ORIGINAL = 0;
    /**
     * 退款方式 1线下退款
     */
    public static final int REFUND_BACK_TYPE_OFFLINE = 1;

    /**
     * 订单改签类型 老订单
     */
    public static final int ORDER_CHANGE_TYPE_OLD = 0;
    /**
     * 订单改签类型 新订单
     */
    public static final int ORDER_CHANGE_TYPE_NEW = 1;

    /**
     * 订单计调状态 待出票
     */
    public static final int ORDER_DISPATCH_STATUS_WAIT = 0;
    /**
     * 订单计调状态 部分出票
     */
    public static final int ORDER_DISPATCH_STATUS_PART = 1;
    /**
     * 订单计调状态 全部出票
     */
    public static final int ORDER_DISPATCH_STATUS_FINISH = 2;
    /**
     * 支付单-订单类型 交易订单
     */
    public static final int PAY_ORDER_TYPE_TRADE = 0;
    /**
     * 支付单-订单类型 其他订单
     */
    public static final int PAY_ORDER_TYPE_OTHER = 1;

    /**
     * 支付单-订单类型 定金支付
     */
    public static final int PAY_ORDER_TYPE_DEPOSI = 2;
    public static final int PAY_ORDER_TYPE_BC = 3;

    /**
     * redis 缓存，时间方案最小时间
     */
    public static final String REDIS_KEY_PRODUCT_ROUTE_PLAN_MIN_DETAIL = "product_route_plan_min_detail";
    public static final String REDIS_KEY_PAY_CHANNEL = "pay_channel";

    /**
     * 退款类型 0交易订单退款
     */
    public static final int REFUND_RECORD_TYPE_TRADE = 0;

    /**
     * 退款类型 1自动退款
     */
    public static final int REFUND_RECORD_TYPE_AUTO = 1;

    /**
     * 退款类型 2营销政策退款
     */
    public static final int REFUND_RECORD_TYPE_MARKETING = 2;
    /**
     * 售后退款，不退票
     */
    public static final int REFUND_RECORD_TYPE_SERVICE = 3;
    /**
     * 补票退款
     */
    public static final int REFUND_RECORD_TYPE_SUPP_TICKET = 4;
    /**
     * 导游代退-平台
     */
    public static final int REFUND_RECORD_TYPE_GUIDE_PLAT = 5;
    /**
     * 导游代退-内部旅行社
     */
    public static final int REFUND_RECORD_TYPE_GUIDE_INNER = 6;

    /**
     * 交付类型 0邮寄 1自提
     */
    public static final int DELIVERY_TYPE_EXPRESS = 0;
    public static final int DELIVERY_TYPE_PICKUP = 1;

    public static String getRefundMethodName(Integer type){
        if(type == null){
            return "退款";
        }
        switch (type){
            case REFUND_METHOD_NORMAL:
                return "正常退款";
            case REFUND_METHOD_FORCE:
                return "强制退款";
            case REFUND_METHOD_CHANGE_ORDER:
                return "改签退款";
            case REFUND_METHOD_CONFIRM_ORDER:
                return "二次确认订单退款";
            case REFUND_METHOD_OVERDUE_ORDER:
                return "过期自动退款";
            default:
                return "退款";
        }
    }

}
