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

/**
 * Builder for model MerchantPreferences
 *
 * @see MerchantPreferences
 */
class MerchantPreferencesBuilder
{
    /**
     * @var MerchantPreferences
     */
    private $instance;

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

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

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

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

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