<?php

declare (strict_types=1);
/*
 * PaypalServerSdkLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
namespace FormGent\PaypalServerSdkLib\Models;

use FormGent\PaypalServerSdkLib\ApiHelper;
use stdClass;
/**
 * Customizes the payer experience during the 3DS Approval for payment.
 */
class CardExperienceContext implements \JsonSerializable
{
    /**
     * @var string|null
     */
    private $returnUrl;
    /**
     * @var string|null
     */
    private $cancelUrl;
    /**
     * Returns Return Url.
     * Describes the URL.
     */
    public function getReturnUrl() : ?string
    {
        return $this->returnUrl;
    }
    /**
     * Sets Return Url.
     * Describes the URL.
     *
     * @maps return_url
     */
    public function setReturnUrl(?string $returnUrl) : void
    {
        $this->returnUrl = $returnUrl;
    }
    /**
     * Returns Cancel Url.
     * Describes the URL.
     */
    public function getCancelUrl() : ?string
    {
        return $this->cancelUrl;
    }
    /**
     * Sets Cancel Url.
     * Describes the URL.
     *
     * @maps cancel_url
     */
    public function setCancelUrl(?string $cancelUrl) : void
    {
        $this->cancelUrl = $cancelUrl;
    }
    /**
     * Converts the CardExperienceContext object to a human-readable string representation.
     *
     * @return string The string representation of the CardExperienceContext object.
     */
    public function __toString() : string
    {
        return ApiHelper::stringify('CardExperienceContext', ['returnUrl' => $this->returnUrl, 'cancelUrl' => $this->cancelUrl]);
    }
    /**
     * Encode this object to JSON
     *
     * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields
     *        are set. (default: false)
     *
     * @return array|stdClass
     */
    #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1)
    public function jsonSerialize(bool $asArrayWhenEmpty = \false)
    {
        $json = [];
        if (isset($this->returnUrl)) {
            $json['return_url'] = $this->returnUrl;
        }
        if (isset($this->cancelUrl)) {
            $json['cancel_url'] = $this->cancelUrl;
        }
        return !$asArrayWhenEmpty && empty($json) ? new stdClass() : $json;
    }
}
