package com.ms.biz.consts;

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

public class Refund1688Const {
    public static final String REFUND_STATUS_WAIT_SELLER_AGREE = "waitselleragree";

    public static final String REFUND_STATUS_REFUND_SUCCESS = "refundsuccess";

    public static final String REFUND_STATUS_REFUND_CLOSE = "refundclose";

    public static final String REFUND_STATUS_WAIT_BUYER_MODIFY = "waitbuyermodify";

    public static final String REFUND_STATUS_WAIT_BUYER_SEND = "waitbuyersend";

    public static final String REFUND_STATUS_WAIT_SELLER_RECEIVE = "waitsellerreceive";

    /**
     * 买家申请退款
     */
    public static final String ACTION_BUYER_APPLY_REFUND = "BUYER_APPLY_REFUND";

    /**
     * 买家确认收货关闭
     */
    public static final String ACTION_BUYER_RECEIVE_CLOSE = "BUYER_RECEIVE_CLOSE";

    /**
     * 卖家发货关闭
     */
    public static final String ACTION_SELLER_SEND_GOODS_CLOSE = "SELLER_SEND_GOODS_CLOSE";

    /**
     * 买家撤销退款申请关闭
     */
    public static final String ACTION_BUYER_CANCEL_REFUND_CLOSE = "BUYER_CANCEL_REFUND_CLOSE";

    /**
     * 买家上传凭证
     */
    public static final String ACTION_BUYER_UPLOAD_BILL = "BUYER_UPLOAD_BILL";

    /**
     * 卖家上传凭证
     */
    public static final String ACTION_SELLER_UPLOAD_BILL = "SELLER_UPLOAD_BILL";

    /**
     * 卖家拒绝退款
     */
    public static final String ACTION_SELLER_REJECT_REFUND = "SELLER_REJECT_REFUND";

    /**
     * 卖家同意退款
     */
    public static final String ACTION_SELLER_AGREE_REFUND = "SELLER_AGREE_REFUND";

    /**
     * 卖家确认收货
     */
    public static final String ACTION_SELLER_RECEIVE_GOODS = "SELLER_RECEIVE_GOODS";

    /**
     * 买家声明发货
     */
    public static final String ACTION_BUYER_SEND_GOODS = "BUYER_SEND_GOODS";

    /**
     * 买家修改退款协议
     */
    public static final String ACTION_BUYER_MODIFY_REFUND_PROTOCOL = "BUYER_MODIFY_REFUND_PROTOCOL";

    /**
     * 买家申请客服介入
     */
    public static final String ACTION_BUYER_APPLY_SUPPORT = "BUYER_APPLY_SUPPORT";

    /**
     * 卖家申请客服介入
     */
    public static final String ACTION_SELLER_APPLY_SUPPORT = "SELLER_APPLY_SUPPORT";

    /**
     * 系统超时同意退款协议
     */
    public static final String ACTION_SYSTEM_AGREE_REFUND_PROTOCOL = "SYSTEM_AGREE_REFUND_PROTOCOL";

    /**
     * 系统超时同意退款，即退款成功
     */
    public static final String ACTION_SYSTEM_AGREE_REFUND = "SYSTEM_AGREE_REFUND";

    /**
     * 系统超时退货，主交易流程的退货
     */
    public static final String ACTION_SYSTEM_SEND_GOODS = "SYSTEM_SEND_GOODS";

    /**
     * 系统超时修改协议
     */
    public static final String ACTION_SYSTEM_MODIFY_REFUND_PROTOCOL = "SYSTEM_MODIFY_REFUND_PROTOCOL";

    /**
     * 系统通知申请客服介入
     */
    public static final String ACTION_SYSTEM_NOTIFY_APPLY_SUPPORT = "SYSTEM_NOTIFY_APPLY_SUPPORT";

    /**
     * 卖家同意退款协议
     */
    public static final String ACTION_SELLER_AGREE_REFUND_PROCOTOL = "SELLER_AGREE_REFUND_PROCOTOL";

    /**
     * 卖家拒绝退款协议
     */
    public static final String ACTION_SELLER_REJECT_REFUND_PROCOTOL = "SELLER_REJECT_REFUND_PROCOTOL";

    /**
     * 申请客服介入,超时关闭,目前仅售后业务在用
     */
    public static final String ACTION_CRM_APPLY_TIMEOUT_CLOSE = "CRM_APPLY_TIMEOUT_CLOSE";

    /**
     * CRM申请介入
     */
    public static final String ACTION_CRM_APPLY_SUPPORT = "CRM_APPLY_SUPPORT";

    /**
     * CRM介入处理
     */
    public static final String ACTION_CRM_INTERVENE_TASK = "CRM_INTERVENE_TASK";

    /**
     * CRM撤销工单
     */
    public static final String ACTION_CRM_DISMISS_TASK = "CRM_DISMISS_TASK";

    /**
     * CRM完结工单
     */
    public static final String ACTION_CRM_FINISH_TASK = "CRM_FINISH_TASK";

    /**
     * 买家支付，退款关闭，分阶段订单情况
     */
    public static final String ACTION_BUYER_STEP_PAY_ORDER_CLOSE = "BUYER_STEP_PAY_ORDER_CLOSE";

    /**
     * 买家确认，退款关闭，分阶段订单情况
     */
    public static final String ACTION_BUYER_STEP_CONFIRM_CLOSE = "BUYER_STEP_CONFIRM_CLOSE";

    /**
     * 买家终止交易，退款关闭，分阶段订单情况
     */
    public static final String ACTION_BUYER_CLOSE_TRADE_CLOSE = "BUYER_CLOSE_TRADE_CLOSE";

    /**
     * 卖家确认，退款关闭，分阶段订单情况
     */
    public static final String ACTION_SELLER_CONFIRM_ORDER_CLOSE = "SELLER_CONFIRM_ORDER_CLOSE";

    /**
     * 卖家推进，退款关闭，分阶段订单情况
     */
    public static final String ACTION_SELLER_STEP_PUSH_CLOSE = "SELLER_STEP_PUSH_CLOSE";

    public static boolean isCloseAction(String refundAction) {
        List<String> closeActions = Arrays.asList(
                ACTION_BUYER_CANCEL_REFUND_CLOSE,
                ACTION_CRM_APPLY_TIMEOUT_CLOSE,
                ACTION_BUYER_STEP_PAY_ORDER_CLOSE,
                ACTION_BUYER_STEP_CONFIRM_CLOSE,
                ACTION_BUYER_CLOSE_TRADE_CLOSE,
                ACTION_SELLER_CONFIRM_ORDER_CLOSE,
                ACTION_SELLER_STEP_PUSH_CLOSE
        );
        return closeActions.contains(refundAction);
    }

    public static boolean isAgreeRefundAction(String refundAction) {
        List<String> closeActions = Arrays.asList(
                ACTION_SELLER_AGREE_REFUND,
                ACTION_SYSTEM_AGREE_REFUND
        );
        return closeActions.contains(refundAction);
    }

    public static boolean isRejectRefundAction(String refundAction) {
        List<String> closeActions = Arrays.asList(
                ACTION_SELLER_REJECT_REFUND,
                ACTION_SELLER_REJECT_REFUND_PROCOTOL
        );
        return closeActions.contains(refundAction);
    }
}
