<?php

declare(strict_types=1);

namespace Gls\GlsPoland\AdePlus\ParcelShop;

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

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

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

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

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

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

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

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

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

        return $new;
    }

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

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

        return $new;
    }

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

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

        return $new;
    }

    public function getStreet(): string
    {
        return $this->street;
    }

    public function withStreet(string $street): AdeParcelShopSearchByZip
    {
        $new = clone $this;
        $new->street = $street;

        return $new;
    }
}
