<?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\OrderAuthorizeRequest;
use PaypalServerSDKLib\Models\OrderAuthorizeRequestPaymentSource;

/**
 * Builder for model OrderAuthorizeRequest
 *
 * @see OrderAuthorizeRequest
 */
class OrderAuthorizeRequestBuilder
{
    /**
     * @var OrderAuthorizeRequest
     */
    private $instance;

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

    /**
     * Initializes a new order authorize request Builder object.
     */
    public static function init(): self
    {
        return new self(new OrderAuthorizeRequest());
    }

    /**
     * Sets payment source field.
     */
    public function paymentSource(?OrderAuthorizeRequestPaymentSource $value): self
    {
        $this->instance->setPaymentSource($value);
        return $this;
    }

    /**
     * Initializes a new order authorize request object.
     */
    public function build(): OrderAuthorizeRequest
    {
        return CoreHelper::clone($this->instance);
    }
}
