<?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;
/**
 * Information needed to pay using giropay.
 */
class GiropayPaymentRequest implements \JsonSerializable
{
    /**
     * @var string
     */
    private $name;
    /**
     * @var string
     */
    private $countryCode;
    /**
     * @var ExperienceContext|null
     */
    private $experienceContext;
    /**
     * @param string $name
     * @param string $countryCode
     */
    public function __construct(string $name, string $countryCode)
    {
        $this->name = $name;
        $this->countryCode = $countryCode;
    }
    /**
     * Returns Name.
     * The full name representation like Mr J Smith.
     */
    public function getName() : string
    {
        return $this->name;
    }
    /**
     * Sets Name.
     * The full name representation like Mr J Smith.
     *
     * @required
     * @maps name
     */
    public function setName(string $name) : void
    {
        $this->name = $name;
    }
    /**
     * Returns Country Code.
     * The [two-character ISO 3166-1 code](/api/rest/reference/country-codes/) that identifies the country
     * or region. Note: The country code for Great Britain is GB and not UK as used in the top-level domain
     * names for that country. Use the `C2` country code for China worldwide for comparable uncontrolled
     * price (CUP) method, bank card, and cross-border transactions.
     */
    public function getCountryCode() : string
    {
        return $this->countryCode;
    }
    /**
     * Sets Country Code.
     * The [two-character ISO 3166-1 code](/api/rest/reference/country-codes/) that identifies the country
     * or region. Note: The country code for Great Britain is GB and not UK as used in the top-level domain
     * names for that country. Use the `C2` country code for China worldwide for comparable uncontrolled
     * price (CUP) method, bank card, and cross-border transactions.
     *
     * @required
     * @maps country_code
     */
    public function setCountryCode(string $countryCode) : void
    {
        $this->countryCode = $countryCode;
    }
    /**
     * Returns Experience Context.
     * Customizes the payer experience during the approval process for the payment.
     */
    public function getExperienceContext() : ?ExperienceContext
    {
        return $this->experienceContext;
    }
    /**
     * Sets Experience Context.
     * Customizes the payer experience during the approval process for the payment.
     *
     * @maps experience_context
     */
    public function setExperienceContext(?ExperienceContext $experienceContext) : void
    {
        $this->experienceContext = $experienceContext;
    }
    /**
     * Converts the GiropayPaymentRequest object to a human-readable string representation.
     *
     * @return string The string representation of the GiropayPaymentRequest object.
     */
    public function __toString() : string
    {
        return ApiHelper::stringify('GiropayPaymentRequest', ['name' => $this->name, 'countryCode' => $this->countryCode, 'experienceContext' => $this->experienceContext]);
    }
    /**
     * 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 = [];
        $json['name'] = $this->name;
        $json['country_code'] = $this->countryCode;
        if (isset($this->experienceContext)) {
            $json['experience_context'] = $this->experienceContext;
        }
        return !$asArrayWhenEmpty && empty($json) ? new stdClass() : $json;
    }
}
