<?php

declare(strict_types=1);

/*
 * PaypalServerSDKLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */

namespace PaypalServerSDKLib\Models\Builders;

use Core\Utils\CoreHelper;
use PaypalServerSDKLib\Models\ApplePayRequest;
use PaypalServerSDKLib\Models\BancontactPaymentRequest;
use PaypalServerSDKLib\Models\BLIKPaymentRequest;
use PaypalServerSDKLib\Models\CardRequest;
use PaypalServerSDKLib\Models\EPSPaymentRequest;
use PaypalServerSDKLib\Models\GiropayPaymentRequest;
use PaypalServerSDKLib\Models\GooglePayRequest;
use PaypalServerSDKLib\Models\IDEALPaymentRequest;
use PaypalServerSDKLib\Models\MyBankPaymentRequest;
use PaypalServerSDKLib\Models\P24PaymentRequest;
use PaypalServerSDKLib\Models\PaymentSource;
use PaypalServerSDKLib\Models\PayPalWallet;
use PaypalServerSDKLib\Models\SofortPaymentRequest;
use PaypalServerSDKLib\Models\Token;
use PaypalServerSDKLib\Models\TrustlyPaymentRequest;
use PaypalServerSDKLib\Models\VenmoWalletRequest;

/**
 * Builder for model PaymentSource
 *
 * @see PaymentSource
 */
class PaymentSourceBuilder
{
    /**
     * @var PaymentSource
     */
    private $instance;

    private function __construct(PaymentSource $instance)
    {
        $this->instance = $instance;
    }

    /**
     * Initializes a new payment source Builder object.
     */
    public static function init(): self
    {
        return new self(new PaymentSource());
    }

    /**
     * Sets card field.
     */
    public function card(?CardRequest $value): self
    {
        $this->instance->setCard($value);
        return $this;
    }

    /**
     * Sets token field.
     */
    public function token(?Token $value): self
    {
        $this->instance->setToken($value);
        return $this;
    }

    /**
     * Sets paypal field.
     */
    public function paypal(?PayPalWallet $value): self
    {
        $this->instance->setPaypal($value);
        return $this;
    }

    /**
     * Sets bancontact field.
     */
    public function bancontact(?BancontactPaymentRequest $value): self
    {
        $this->instance->setBancontact($value);
        return $this;
    }

    /**
     * Sets blik field.
     */
    public function blik(?BLIKPaymentRequest $value): self
    {
        $this->instance->setBlik($value);
        return $this;
    }

    /**
     * Sets eps field.
     */
    public function eps(?EPSPaymentRequest $value): self
    {
        $this->instance->setEps($value);
        return $this;
    }

    /**
     * Sets giropay field.
     */
    public function giropay(?GiropayPaymentRequest $value): self
    {
        $this->instance->setGiropay($value);
        return $this;
    }

    /**
     * Sets ideal field.
     */
    public function ideal(?IDEALPaymentRequest $value): self
    {
        $this->instance->setIdeal($value);
        return $this;
    }

    /**
     * Sets mybank field.
     */
    public function mybank(?MyBankPaymentRequest $value): self
    {
        $this->instance->setMybank($value);
        return $this;
    }

    /**
     * Sets p 24 field.
     */
    public function p24(?P24PaymentRequest $value): self
    {
        $this->instance->setP24($value);
        return $this;
    }

    /**
     * Sets sofort field.
     */
    public function sofort(?SofortPaymentRequest $value): self
    {
        $this->instance->setSofort($value);
        return $this;
    }

    /**
     * Sets trustly field.
     */
    public function trustly(?TrustlyPaymentRequest $value): self
    {
        $this->instance->setTrustly($value);
        return $this;
    }

    /**
     * Sets apple pay field.
     */
    public function applePay(?ApplePayRequest $value): self
    {
        $this->instance->setApplePay($value);
        return $this;
    }

    /**
     * Sets google pay field.
     */
    public function googlePay(?GooglePayRequest $value): self
    {
        $this->instance->setGooglePay($value);
        return $this;
    }

    /**
     * Sets venmo field.
     */
    public function venmo(?VenmoWalletRequest $value): self
    {
        $this->instance->setVenmo($value);
        return $this;
    }

    /**
     * Initializes a new payment source object.
     */
    public function build(): PaymentSource
    {
        return CoreHelper::clone($this->instance);
    }
}
