<?php

declare(strict_types=1);

namespace Gls\GlsPoland\AdePlus\Type;

use JsonSerializable;
use Gls\GlsPoland\Soap\Client\Type\RequestInterface;

final class AdeZipGetCity implements RequestInterface, JsonSerializable
{
    /**
     * @var string
     */
    private $session;

    /**
     * @var string
     */
    private $country;

    /**
     * @var string
     */
    private $zipcode;

    public function __construct(string $session, string $country, string $zipcode)
    {
        $this->session = $session;
        $this->country = $country;
        $this->zipcode = $zipcode;
    }

    public function jsonSerialize(): array
    {
        return [
            'session' => $this->session,
            'country' => $this->country,
            'zipcode' => $this->zipcode,
        ];
    }

    public function getSession(): string
    {
        return $this->session;
    }

    public function withSession(string $session): AdeZipGetCity
    {
        $new = clone $this;
        $new->session = $session;

        return $new;
    }

    public function getCountry(): string
    {
        return $this->country;
    }

    public function withCountry(string $country): AdeZipGetCity
    {
        $new = clone $this;
        $new->country = $country;

        return $new;
    }

    public function getZipcode(): string
    {
        return $this->zipcode;
    }

    public function withZipcode(string $zipcode): AdeZipGetCity
    {
        $new = clone $this;
        $new->zipcode = $zipcode;

        return $new;
    }
}
