<?php

namespace DhlPolskaVendor\Octolize\DhlPolska\API\WebApi\Struct;

use JsonSerializable;
/**
 * Addressat structure for createShipment.
 */
class Addressat implements JsonSerializable
{
    /** @var PreavisoContact|null */
    private ?PreavisoContact $preaviso;
    /** @var PreavisoContact|null */
    private ?PreavisoContact $contact;
    /** @var Address|null */
    private ?Address $address;
    /**
     * Addressat constructor.
     *
     * @param PreavisoContact|null $preaviso
     * @param PreavisoContact|null $contact
     * @param Address|null         $address
     */
    public function __construct(?PreavisoContact $preaviso, ?PreavisoContact $contact, ?Address $address)
    {
        $this->preaviso = $preaviso;
        $this->contact = $contact;
        $this->address = $address;
    }
    /**
     * @return array
     */
    public function jsonSerialize(): array
    {
        return array_filter(['preaviso' => $this->preaviso, 'contact' => $this->contact, 'address' => $this->address], static fn($value) => $value !== null);
    }
}
