<?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\CardResponseWithBillingAddress;
use PaypalServerSdkLib\Models\SubscriptionPaymentSourceResponse;

/**
 * Builder for model SubscriptionPaymentSourceResponse
 *
 * @see SubscriptionPaymentSourceResponse
 */
class SubscriptionPaymentSourceResponseBuilder
{
    /**
     * @var SubscriptionPaymentSourceResponse
     */
    private $instance;

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

    /**
     * Initializes a new Subscription Payment Source Response Builder object.
     */
    public static function init(): self
    {
        return new self(new SubscriptionPaymentSourceResponse());
    }

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

    /**
     * Initializes a new Subscription Payment Source Response object.
     */
    public function build(): SubscriptionPaymentSourceResponse
    {
        return CoreHelper::clone($this->instance);
    }
}
