<?php

declare(strict_types=1);

namespace Gls\GlsPoland\AdePlus\Type;

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

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

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

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

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

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

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

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

        return $new;
    }

    public function getOption(): string
    {
        return $this->option;
    }

    public function withOption(string $option): AdeOptionSet
    {
        $new = clone $this;
        $new->option = $option;

        return $new;
    }

    public function getValue(): string
    {
        return $this->value;
    }

    public function withValue(string $value): AdeOptionSet
    {
        $new = clone $this;
        $new->value = $value;

        return $new;
    }
}
