<?php

/**
 * Class ReturnAddressat
 *
 * @package Octolize\DhlPolska\API\WebApi\Struct
 */
namespace DhlPolskaVendor\Octolize\DhlPolska\API\WebApi\Struct;

use JsonSerializable;
/**
 * ReturnAddressat structure.
 */
class ReturnAddressat implements JsonSerializable
{
    /** @var PreavisoContact|null */
    private ?PreavisoContact $preaviso;
    /** @var PreavisoContact|null */
    private ?PreavisoContact $contact;
    /** @var ShipperAddress|null */
    private ?ShipperAddress $address;
    /**
     * ReturnAddressat constructor.
     *
     * @param PreavisoContact|null $preaviso
     * @param PreavisoContact|null $contact
     * @param ShipperAddress|null  $address
     */
    public function __construct(?PreavisoContact $preaviso, ?PreavisoContact $contact, ?ShipperAddress $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);
    }
}
