<?php

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

use JsonSerializable;
/**
 * PaymentData structure.
 */
class PaymentData implements JsonSerializable
{
    /** @var string */
    private string $payment_method;
    /** @var string */
    private string $payer_type;
    /** @var string|null */
    private ?string $account_number;
    /** @var string|null */
    private ?string $costs_center;
    /**
     * PaymentData constructor.
     *
     * @param string      $payment_method
     * @param string      $payer_type
     * @param string|null $account_number
     * @param string|null $costs_center
     */
    public function __construct(string $payment_method, string $payer_type, ?string $account_number = null, ?string $costs_center = null)
    {
        $this->payment_method = $payment_method;
        $this->payer_type = $payer_type;
        $this->account_number = $account_number;
        $this->costs_center = $costs_center;
    }
    /**
     * @return array
     */
    public function jsonSerialize(): array
    {
        return array_filter(['paymentMethod' => $this->payment_method, 'payerType' => $this->payer_type, 'accountNumber' => $this->account_number, 'costsCenter' => $this->costs_center], static fn($value) => $value !== null);
    }
}
