<?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.
     */
    public function expiry(?string $value): self
    {
        $this->instance->setExpiry($value);
        return $this;
    }

    /**
     * Sets last digits field.
     */
    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);
    }
}
