<?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\BinDetails;
use PaypalServerSdkLib\Models\CardAuthenticationResponse;
use PaypalServerSdkLib\Models\CardPaymentTokenEntity;
use PaypalServerSdkLib\Models\CardResponseAddress;
use PaypalServerSdkLib\Models\CardVerificationDetails;
use PaypalServerSdkLib\Models\NetworkTransactionReferenceEntity;

/**
 * Builder for model CardPaymentTokenEntity
 *
 * @see CardPaymentTokenEntity
 */
class CardPaymentTokenEntityBuilder
{
    /**
     * @var CardPaymentTokenEntity
     */
    private $instance;

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

    /**
     * Initializes a new Card Payment Token Entity Builder object.
     */
    public static function init(): self
    {
        return new self(new CardPaymentTokenEntity());
    }

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

    /**
     * Sets last digits field.
     *
     * @param string|null $value
     */
    public function lastDigits(?string $value): self
    {
        $this->instance->setLastDigits($value);
        return $this;
    }

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

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

    /**
     * Sets billing address field.
     *
     * @param CardResponseAddress|null $value
     */
    public function billingAddress(?CardResponseAddress $value): self
    {
        $this->instance->setBillingAddress($value);
        return $this;
    }

    /**
     * Sets verification status field.
     *
     * @param string|null $value
     */
    public function verificationStatus(?string $value): self
    {
        $this->instance->setVerificationStatus($value);
        return $this;
    }

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

    /**
     * Sets network transaction reference field.
     *
     * @param NetworkTransactionReferenceEntity|null $value
     */
    public function networkTransactionReference(?NetworkTransactionReferenceEntity $value): self
    {
        $this->instance->setNetworkTransactionReference($value);
        return $this;
    }

    /**
     * Sets authentication result field.
     *
     * @param CardAuthenticationResponse|null $value
     */
    public function authenticationResult(?CardAuthenticationResponse $value): self
    {
        $this->instance->setAuthenticationResult($value);
        return $this;
    }

    /**
     * Sets bin details field.
     *
     * @param BinDetails|null $value
     */
    public function binDetails(?BinDetails $value): self
    {
        $this->instance->setBinDetails($value);
        return $this;
    }

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

    /**
     * Initializes a new Card Payment Token Entity object.
     */
    public function build(): CardPaymentTokenEntity
    {
        return CoreHelper::clone($this->instance);
    }
}
