<?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\PhoneNumber;
use PaypalServerSdkLib\Models\PhoneWithType;

/**
 * Builder for model PhoneWithType
 *
 * @see PhoneWithType
 */
class PhoneWithTypeBuilder
{
    /**
     * @var PhoneWithType
     */
    private $instance;

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

    /**
     * Initializes a new Phone With Type Builder object.
     *
     * @param PhoneNumber $phoneNumber
     */
    public static function init(PhoneNumber $phoneNumber): self
    {
        return new self(new PhoneWithType($phoneNumber));
    }

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

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