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

/**
 * Builder for model CardExperienceContext
 *
 * @see CardExperienceContext
 */
class CardExperienceContextBuilder
{
    /**
     * @var CardExperienceContext
     */
    private $instance;

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

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

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

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

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