<?php

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

/**
 * ReceiverAddressData structure.
 */
class ReceiverAddressData extends AddressData
{
    /** @var string */
    private string $address_type;
    /** @var string */
    private string $country;
    /** @var bool|null */
    private ?bool $is_packstation;
    /** @var bool|null */
    private ?bool $is_postfiliale;
    /** @var string|null */
    private ?string $postnummer;
    /**
     * ReceiverAddressData constructor.
     *
     * @param string      $name
     * @param string      $street
     * @param string      $house_number
     * @param string      $city
     * @param string      $postal_code
     * @param string      $country
     * @param string      $address_type
     * @param string|null $apartment_number
     * @param string|null $contact_person
     * @param string|null $contact_phone
     * @param string|null $contact_email
     * @param bool|null   $is_packstation
     * @param bool|null   $is_postfiliale
     * @param string|null $postnummer
     */
    public function __construct(string $name, string $street, string $house_number, string $city, string $postal_code, string $country, string $address_type, ?string $apartment_number = null, ?string $contact_person = null, ?string $contact_phone = null, ?string $contact_email = null, ?bool $is_packstation = null, ?bool $is_postfiliale = null, ?string $postnummer = null)
    {
        parent::__construct($name, $street, $house_number, $city, $postal_code, $apartment_number, $contact_person, $contact_phone, $contact_email);
        $this->country = $country;
        $this->address_type = $address_type;
        $this->is_packstation = $is_packstation;
        $this->is_postfiliale = $is_postfiliale;
        $this->postnummer = $postnummer;
    }
    /**
     * @return array
     */
    public function jsonSerialize(): array
    {
        $data = parent::jsonSerialize();
        $data['country'] = $this->country;
        $data['addressType'] = $this->address_type;
        $data['isPackstation'] = $this->is_packstation;
        $data['isPostfiliale'] = $this->is_postfiliale;
        $data['postnummer'] = $this->postnummer;
        return array_filter($data, static fn($value) => $value !== null);
    }
}
