<?php

namespace DhlPolska\API\ParcelShop\Struct;

use JsonSerializable;

/**
 * ShipmentInfo structure for ParcelShop API.
 */
class ShipmentInfo implements JsonSerializable {

	/** @var string */
	private string $drop_off_type;

	/** @var string */
	private string $service_type;

	/** @var BillingData */
	private BillingData $billing;

	/** @var SpecialService[] */
	private array $special_services;

	/** @var string */
	private string $shipment_date;

	/** @var string */
	private string $shipment_start_hour;

	/** @var string */
	private string $shipment_end_hour;

	/** @var string */
	private string $label_type;

	/**
	 * ShipmentInfo constructor.
	 *
	 * @param string           $drop_off_type
	 * @param string           $service_type
	 * @param BillingData      $billing
	 * @param string           $shipment_date
	 * @param string           $shipment_start_hour
	 * @param string           $shipment_end_hour
	 * @param string           $label_type
	 * @param SpecialService[] $special_services
	 */
	public function __construct(
		string $drop_off_type,
		string $service_type,
		BillingData $billing,
		string $shipment_date,
		string $shipment_start_hour,
		string $shipment_end_hour,
		string $label_type = 'BLP',
		array $special_services = []
	) {
		$this->drop_off_type       = $drop_off_type;
		$this->service_type        = $service_type;
		$this->billing             = $billing;
		$this->shipment_date       = $shipment_date;
		$this->shipment_start_hour = $shipment_start_hour;
		$this->shipment_end_hour   = $shipment_end_hour;
		$this->label_type          = $label_type;
		$this->special_services    = $special_services;
	}

	/**
	 * @return array
	 */
	public function jsonSerialize(): array {
		return [
			'dropOffType'       => $this->drop_off_type,
			'serviceType'       => $this->service_type,
			'billing'           => $this->billing,
			'specialServices'   => $this->special_services,
			'shipmentDate'      => $this->shipment_date,
			'shipmentStartHour' => $this->shipment_start_hour,
			'shipmentEndHour'   => $this->shipment_end_hour,
			'labelType'         => $this->label_type,
		];
	}
}
