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

/**
 * Builder for model Name
 *
 * @see Name
 */
class NameBuilder
{
    /**
     * @var Name
     */
    private $instance;

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

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

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

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

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