import { PaymentRequest,BuildPayload } from './PaymentRequest';

export class PayOutPaymentRequest extends PaymentRequest {
   orderId?: string;
   title?: string;
   description?: string;
   payeeName?: string;
   payeeBankCode?: string;
   payeeBankAccNo?: string;
   payeePhoneNo?: string;
   amount?: number;
   currency?: string;
   notifyUrl?: string;
   remark?: string;

  constructor(
    paymentRequest: PaymentRequest,
    orderId?: string,
    title?: string,
    description?: string,
    payeeName?: string,
    payeeBankCode?: string,
    payeeBankAccNo?: string,
    payeePhoneNo?: string,
    amount?: number,
    currency?: string,
    notifyUrl?: string,
    remark?: string,
  ) {
    super(paymentRequest.requestTime, paymentRequest.version, paymentRequest.nonceStr);
    this.orderId = orderId;
    this.title = title;
    this.description = description;
    this.payeeName = payeeName;
    this.payeeBankCode = payeeBankCode;
    this.payeeBankAccNo = payeeBankAccNo;
    this.payeePhoneNo = payeePhoneNo;
    this.currency = currency;
    this.amount = amount;
    this.currency = currency;
    this.notifyUrl = notifyUrl;
    this.remark = remark
  }

  public toJSON(): object {
    return {
      requestTime: this.requestTime,
      version: this.version,
      nonceStr: this.nonceStr,
      orderId: this.orderId,
      title: this.title,
      description: this.description,
      payeeName: this.payeeName,
      payeeBankCode: this.payeeBankCode,
      payeeBankAccNo: this.payeeBankAccNo,
      payeePhoneNo: this.payeePhoneNo,
      amount: this.amount,
      currency: this.currency,
      notifyUrl: this.notifyUrl,
      remark: this.remark,
    };
  }
}


export class PayOutPaymentRequestBuilder extends BuildPayload {
   
    private orderId?: string;
    private title?: string;
    private description?: string;
    private payeeName?: string;
    private payeeBankCode?: string;
    private payeeBankAccNo?: string;
    private payeePhoneNo?: string;
    private amount?: number;
    private currency?: string;
    private notifyUrl?: string;
    private remark?: string;
  
    constructor(requestTime: number, version: string, nonceStr: string) {
      super(requestTime, version, nonceStr);
      
    }
  
    public setOrderId(orderId: string): PayOutPaymentRequestBuilder {
      this.orderId = orderId;
      return this;
    }
  
    public setTitle(title: string): PayOutPaymentRequestBuilder {
      this.title = title;
      return this;
    }
  
    public setDescription(description: string): PayOutPaymentRequestBuilder {
      this.description = description;
      return this;
    }
  
    public setPayeeName(payeeName: string): PayOutPaymentRequestBuilder {
      this.payeeName = payeeName;
      return this;
    }
  
    public setPayeeBankCode(payeeBankCode: string): PayOutPaymentRequestBuilder {
      this.payeeBankCode = payeeBankCode;
      return this;
    }
  
    public setPayeeBankAccNo(payeeBankAccNo: string): PayOutPaymentRequestBuilder {
      this.payeeBankAccNo = payeeBankAccNo;
      return this;
    }
  
    public setPayeePhoneNo(payeePhoneNo: string): PayOutPaymentRequestBuilder {
      this.payeePhoneNo = payeePhoneNo;
      return this;
    }
  
    public setAmount(amount: number): PayOutPaymentRequestBuilder {
      this.amount = amount;
      return this;
    }
  
    public setCurrency(currency: string): PayOutPaymentRequestBuilder {
      this.currency = currency;
      return this;
    }
  
    public setNotifyUrl(notifyUrl: string): PayOutPaymentRequestBuilder {
      this.notifyUrl = notifyUrl;
      return this;
    }
  
    public setRemark(remark: string): PayOutPaymentRequestBuilder {
      this.remark = remark;
      return this;
    }
  
    public build(): PayOutPaymentRequest {
      return new PayOutPaymentRequest(
        super.build(),
        this.orderId,
        this.title,
        this.description,
        this.payeeName,
        this.payeeBankCode,
        this.payeeBankAccNo,
        this.payeePhoneNo,
        this.amount,
        this.currency,
        this.notifyUrl,
        this.remark
      );
    }
  }
