<?php

declare(strict_types=1);

namespace Gls\GlsPoland\AdePlus\Type;

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

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

    /**
     * @var int
     */
    private $parcelamount;

    /**
     * @var \DateTimeInterface
     */
    private $date;

    /**
     * @var bool
     */
    private $emailnotification;

    public function __construct(string $session, int $parcelamount, \DateTimeInterface $date, bool $emailnotification)
    {
        $this->session = $session;
        $this->parcelamount = $parcelamount;
        $this->date = $date;
        $this->emailnotification = $emailnotification;
    }

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

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

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

        return $new;
    }

    public function getParcelamount(): int
    {
        return $this->parcelamount;
    }

    public function withParcelamount(int $parcelamount): AdeCourierOrder
    {
        $new = clone $this;
        $new->parcelamount = $parcelamount;

        return $new;
    }

    public function getDate(): \DateTimeInterface
    {
        return $this->date;
    }

    public function withDate(\DateTimeInterface $date): AdeCourierOrder
    {
        $new = clone $this;
        $new->date = $date;

        return $new;
    }

    public function getEmailnotification(): bool
    {
        return $this->emailnotification;
    }

    public function withEmailnotification(bool $emailnotification): AdeCourierOrder
    {
        $new = clone $this;
        $new->emailnotification = $emailnotification;

        return $new;
    }
}
