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

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