<?php
/**
 * Class CreateShipments
 *
 * @package DhlPolska\API\WebApi\Method
 */

namespace DhlPolska\API\WebApi\Method;

use DhlPolska\API\AuthDataInterface;
use DhlPolska\API\ShipmentDataInterface;
use JsonSerializable;

/**
 * CreateShipments structure.
 */
class CreateShipments implements JsonSerializable {

	/**
	 * @var AuthDataInterface
	 */
	private AuthDataInterface $auth_data;

	/**
	 * @var ShipmentDataInterface[]
	 */
	private array $shipments;

	/**
	 * @var bool
	 */
	private bool $skip_restriction_check;

	/**
	 * CreateShipments constructor.
	 *
	 * @param AuthDataInterface       $auth_data               .
	 * @param ShipmentDataInterface[] $shipments              .
	 * @param bool                    $skip_restriction_check .
	 */
	public function __construct( AuthDataInterface $auth_data, array $shipments, bool $skip_restriction_check = false ) {
		$this->auth_data              = $auth_data;
		$this->shipments              = $shipments;
		$this->skip_restriction_check = $skip_restriction_check;
	}

	/**
	 * @return array
	 */
	public function jsonSerialize(): array {
		return [
			'authData'             => $this->auth_data,
			'shipments'            => $this->shipments,
			'skipRestrictionCheck' => $this->skip_restriction_check,
		];
	}
}
