<?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.
     */
    public static function init(PhoneNumber $phoneNumber): self
    {
        return new self(new PhoneWithType($phoneNumber));
    }

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