package com.datarecovery.master.data.api.bean;

import android.util.Pair;

import com.datarecovery.master.module.member.MemberType;

import atmob.reactivex.rxjava3.disposables.Disposable;

public class PayOptions {


    AddDisposable disposable;
    int goodsId;
    String goodsName;
    int amount;
    int payPlatform;
    int payMethod;
    boolean isPermanent;
    @MemberType
    String memberType;

    private ShowLoadingEvent showLoadingEvent;
    private OnSubscribeSuccess onSubscribeSuccess;
    private QRCodeEvent wxQrCodeEvent;
    private Pair<String, String> wxQrCode;
    private QRCodeEvent alQrCodeEvent;
    private Pair<String, String> alQrCode;

    public PayOptions(AddDisposable disposable, int goodsId, String goodsName, int amount, int payPlatform, int payMethod, boolean isPermanent, String memberType, ShowLoadingEvent showLoadingEvent, OnSubscribeSuccess onSubscribeSuccess, QRCodeEvent wxQrCodeEvent, QRCodeEvent alQrCodeEvent) {
        this.disposable = disposable;
        this.goodsId = goodsId;
        this.goodsName = goodsName;
        this.amount = amount;
        this.payPlatform = payPlatform;
        this.payMethod = payMethod;
        this.isPermanent = isPermanent;
        this.memberType = memberType;
        this.showLoadingEvent = showLoadingEvent;
        this.onSubscribeSuccess = onSubscribeSuccess;
        this.wxQrCodeEvent = wxQrCodeEvent;
        this.alQrCodeEvent = alQrCodeEvent;
    }

    public Pair<String, String> getWxQrCode() {
        return wxQrCode;
    }

    public Pair<String, String> getAlQrCode() {
        return alQrCode;
    }

    public boolean isPermanent() {
        return isPermanent;
    }

    public AddDisposable getDisposable() {
        return disposable;
    }

    public int getGoodsId() {
        return goodsId;
    }

    public String getGoodsName() {
        return goodsName;
    }

    public int getAmount() {
        return amount;
    }

    public int getPayPlatform() {
        return payPlatform;
    }

    public int getPayMethod() {
        return payMethod;
    }

    public String getMemberType() {
        return memberType;
    }


    public void addDisposable(Disposable d) {
        if (disposable == null) {
            return;
        }
        disposable.add(d);
    }

    public void setShowLoadingEvent(boolean isShow) {
        if (showLoadingEvent != null) showLoadingEvent.showLoadingEvent(isShow);
    }

    public void setOnSubscribeSuccessEvent(String orderId) {
        if (onSubscribeSuccess != null) onSubscribeSuccess.onSubscribeSuccess(orderId);
    }

    public void setShowWxQRPaymentEvent(Pair<String, String> pair) {
        this.wxQrCode = pair;
        if (wxQrCodeEvent != null) wxQrCodeEvent.showQRCode(this);
    }

    public void setShowAlQRPaymentEvent(Pair<String, String> pair) {
        this.alQrCode = pair;
        if (alQrCodeEvent != null) alQrCodeEvent.showQRCode(this);
    }

    public interface QRCodeEvent {
        void showQRCode(PayOptions payOptions);
    }

    public interface AddDisposable {
        void add(Disposable disposable);
    }

    public interface ShowLoadingEvent {
        void showLoadingEvent(boolean isShow);
    }

    public interface OnSubscribeSuccess {
        void onSubscribeSuccess(String orderId);
    }
}
