<?php

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

use DhlPolskaVendor\Octolize\DhlPolska\API\ShipmentDataInterface;
/**
 * CreateShipmentRequest structure.
 */
class CreateShipmentRequest implements ShipmentDataInterface
{
    /** @var ShipmentInfo */
    private ShipmentInfo $shipment_info;
    /** @var string */
    private string $content;
    /** @var string|null */
    private ?string $comment;
    /** @var string|null */
    private ?string $reference;
    /** @var Ship */
    private Ship $ship;
    /** @var PieceDefinition[] */
    private array $piece_list;
    /** @var mixed|null */
    private $customs;
    /**
     * CreateShipmentRequest constructor.
     *
     * @param ShipmentInfo       $shipment_info
     * @param string             $content
     * @param Ship               $ship
     * @param PieceDefinition[]  $piece_list
     * @param string|null        $comment
     * @param string|null        $reference
     * @param mixed|null         $customs
     */
    public function __construct(ShipmentInfo $shipment_info, string $content, Ship $ship, array $piece_list, ?string $comment = null, ?string $reference = null, $customs = null)
    {
        $this->shipment_info = $shipment_info;
        $this->content = $content;
        $this->ship = $ship;
        $this->piece_list = $piece_list;
        $this->comment = $comment;
        $this->reference = $reference;
        $this->customs = $customs;
    }
    /**
     * @return array
     */
    public function jsonSerialize(): array
    {
        return array_filter(['shipmentInfo' => $this->shipment_info, 'content' => $this->content, 'comment' => $this->comment, 'reference' => $this->reference, 'ship' => $this->ship, 'pieceList' => $this->piece_list, 'customs' => $this->customs], static fn($value) => $value !== null);
    }
}
