<?php

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

/**
 * Receiver address structure for createShipment.
 */
class ReceiverAddress extends Address
{
    /** @var string */
    private string $country;
    /** @var string */
    private string $address_type;
    /** @var bool|null */
    private ?bool $is_packstation;
    /** @var bool|null */
    private ?bool $is_postfiliale;
    /** @var string|null */
    private ?string $postnummer;
    /**
     * ReceiverAddress constructor.
     *
     * @param string      $name
     * @param string      $postal_code
     * @param string      $city
     * @param string      $street
     * @param string      $house_number
     * @param string      $country
     * @param string      $address_type
     * @param string|null $apartment_number
     * @param bool|null   $is_packstation
     * @param bool|null   $is_postfiliale
     * @param string|null $postnummer
     */
    public function __construct(string $name, string $postal_code, string $city, string $street, string $house_number, string $country, string $address_type, ?string $apartment_number = null, ?bool $is_packstation = null, ?bool $is_postfiliale = null, ?string $postnummer = null)
    {
        parent::__construct($name, $postal_code, $city, $street, $house_number, $apartment_number);
        $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);
    }
}
