<?php

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

use JsonSerializable;
/**
 * AddressData structure.
 */
class AddressData implements JsonSerializable
{
    /** @var string */
    private string $name;
    /** @var string */
    private string $street;
    /** @var string */
    private string $house_number;
    /** @var string|null */
    private ?string $apartment_number;
    /** @var string */
    private string $city;
    /** @var string */
    private string $postal_code;
    /** @var string|null */
    private ?string $contact_person;
    /** @var string|null */
    private ?string $contact_phone;
    /** @var string|null */
    private ?string $contact_email;
    /**
     * AddressData constructor.
     *
     * @param string      $name
     * @param string      $street
     * @param string      $house_number
     * @param string      $city
     * @param string      $postal_code
     * @param string|null $apartment_number
     * @param string|null $contact_person
     * @param string|null $contact_phone
     * @param string|null $contact_email
     */
    public function __construct(string $name, string $street, string $house_number, string $city, string $postal_code, ?string $apartment_number = null, ?string $contact_person = null, ?string $contact_phone = null, ?string $contact_email = null)
    {
        $this->name = $name;
        $this->street = $street;
        $this->house_number = $house_number;
        $this->apartment_number = $apartment_number;
        $this->city = $city;
        $this->postal_code = $postal_code;
        $this->contact_person = $contact_person;
        $this->contact_phone = $contact_phone;
        $this->contact_email = $contact_email;
    }
    /**
     * @return array
     */
    public function jsonSerialize(): array
    {
        return array_filter(['name' => $this->name, 'street' => $this->street, 'houseNumber' => $this->house_number, 'apartmentNumber' => $this->apartment_number, 'city' => $this->city, 'postalCode' => $this->postal_code, 'contactPerson' => $this->contact_person, 'contactPhone' => $this->contact_phone, 'contactEmail' => $this->contact_email], static fn($value) => $value !== null);
    }
}
