package com.ruoyi.pay.config;

import com.ruoyi.pay.enums.PaySourceEnums;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * 回调地址
 * @author a
 * @date 2023/10/25 11:36
 */
@Component
@ConfigurationProperties(prefix = "notifyurl")
@Data
public class Notifyurl {

    /**
     * 订单首款支付回调地址
     */
    private String aliOrderUrl;
    private String wxOrderUrl;
    private String lklOrderUrl;

    /**
     * 充值支付回调地址
     */
    private String aliRechargeUrl;

    private String wxRechargeUrl;
    private String lklRechargeUrl;

    /**
     * 保证金支付回调地址
     */
    private String aliBondUrl;

    private String wxBondUrl;
    private String lklBondUrl;

    /**
     * 普通认证支付回调地址
     */
    private String aliAuthUrl;

    private String wxAuthUrl;
    private String lklAuthUrl;


    /**
     * 高端认证支付回调地址
     */
    private String aliHighendAuthUrl;

    private String wxHighendAuthUrl;
    private String lklHighendAuthUrl;


    /**
     * 订单尾款支付回调地址
     */
    private String aliSecondOrderUrl;

    private String wxSecondOrderUrl;
    private String lklSecondOrderUrl;


    /**
     * 设计师调价回调地址
     */
    private String aliAdjustPriceAuthUrl;

    private String wxAdjustPriceAuthUrl;
    private String lklAdjustPriceAuthUrl;


    /**
     * 表现师调价设计师确认回调地址
     */
    private String aliAdjustPriceConfirmAuthUrl;

    private String wxAdjustPriceConfirmAuthUrl;
    private String lklAdjustPriceConfirmAuthUrl;


    /**
     * 获取回调地址
     * @param enums
     * @param type 1支付宝 2微信 3拉卡拉
     * @return
     */
    public String getReturnUrl(PaySourceEnums enums,Integer type){
        switch (enums){
            case order_pay:
                switch (type){
                    case 1:
                        return this.aliOrderUrl;
                    case 2:
                        return this.wxOrderUrl;
                    case 3:
                        return this.lklOrderUrl;
                }
            case recharge_pay:
                switch (type){
                    case 1:
                        return this.aliRechargeUrl;
                    case 2:
                        return this.wxRechargeUrl;
                    case 3:
                        return this.lklRechargeUrl;
                }
            case bond_pay:
                switch (type){
                    case 1:
                        return this.aliBondUrl;
                    case 2:
                        return this.wxBondUrl;
                    case 3:
                        return this.lklBondUrl;
                }
            case auth_pay:
                switch (type){
                    case 1:
                        return this.aliAuthUrl;
                    case 2:
                        return this.wxAuthUrl;
                    case 3:
                        return this.lklAuthUrl;
                }
            case highend_auth_pay:
                switch (type){
                    case 1:
                        return this.aliHighendAuthUrl;
                    case 2:
                        return this.wxHighendAuthUrl;
                    case 3:
                        return this.lklHighendAuthUrl;
                }
            case order_second_pay:
                switch (type){
                    case 1:
                        return this.aliSecondOrderUrl;
                    case 2:
                        return this.wxSecondOrderUrl;
                    case 3:
                        return this.lklSecondOrderUrl;
                }
            case adjust_price_pay:

                switch (type){
                    case 1:
                        return this.aliAdjustPriceAuthUrl;
                    case 2:
                        return this.wxAdjustPriceAuthUrl;
                    case 3:
                        return this.lklAdjustPriceAuthUrl;
                }
            case store_adjust_price_pay:
                switch (type){
                    case 1:
                        return this.aliAdjustPriceConfirmAuthUrl;
                    case 2:
                        return this.wxAdjustPriceConfirmAuthUrl;
                    case 3:
                        return this.lklAdjustPriceConfirmAuthUrl;
                }
            default:
                break;
        }
        return null;
    }

}
