<?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\CardFromRequest;

/**
 * Builder for model CardFromRequest
 *
 * @see CardFromRequest
 */
class CardFromRequestBuilder
{
    /**
     * @var CardFromRequest
     */
    private $instance;

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

    /**
     * Initializes a new Card From Request Builder object.
     */
    public static function init(): self
    {
        return new self(new CardFromRequest());
    }

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

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

    /**
     * Initializes a new Card From Request object.
     */
    public function build(): CardFromRequest
    {
        return CoreHelper::clone($this->instance);
    }
}
