<?php

declare(strict_types=1);

namespace Gls\GlsPoland\AdePlus\Type;

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

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

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

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

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

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

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

        return $new;
    }

    public function getLang(): string
    {
        return $this->lang;
    }

    public function withLang(string $lang): AdeLangChange
    {
        $new = clone $this;
        $new->lang = $lang;

        return $new;
    }
}
