<?php

namespace PostenBringCheckout\admin\api\models;

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

class Order {

	public string $order_id;
	public string $from_country;
	public string $to_country;
	public string $order_shipping_option;
	public float $total_weight;
	public array $mybring_bookings;
	public array $order_validation_errors;
	public array $items;

	public string $recipientName;
	public string $recipientAddressLine;
	public string $recipientPostalCode;
	public string $recipientCity;
	public bool   $nvit;

	/**
	 * @param string $orderId
	 * @param string $from_country
	 * @param string $to_country
	 * @param string $orderShippingOption
	 * @param array  $mybring_bookings
	 * @param array  $order_validation_errors
	 * @param array  $items
	 */
	public function __construct(
		string $orderId,
		string $from_country,
		string $to_country,
		string $orderShippingOption,
		float $total_weight,
		array $mybring_bookings,
		array $order_validation_errors,
		array $items,
		string $recipientName,
		string $recipientAddressLine,
		string $recipientPostalCode,
		string $recipientCity,
		bool $nvit
	) {
		$this->order_id                = $orderId;
		$this->from_country            = $from_country;
		$this->to_country              = $to_country;
		$this->order_shipping_option   = $orderShippingOption;
		$this->total_weight            = $total_weight;
		$this->mybring_bookings        = $mybring_bookings;
		$this->order_validation_errors = $order_validation_errors;
		$this->items                   = $items;
		$this->recipientName           = $recipientName;
		$this->recipientAddressLine    = $recipientAddressLine;
		$this->recipientPostalCode     = $recipientPostalCode;
		$this->recipientCity           = $recipientCity;
		$this->nvit                    = $nvit;
	}

	public function to_array(): array {
		return array(
			'order_id' => $this->order_id,
			'from_country' => $this->from_country,
			'to_country' => $this->to_country,
			'order_shipping_option' => $this->order_shipping_option,
			'total_weight' => $this->total_weight,
			'mybring_bookings' => $this->mybring_bookings,
			'order_validation_errors' => $this->order_validation_errors,
			'items' => $this->items,
			'recipientName' => $this->recipientName,
			'recipientAddressLine' => $this->recipientAddressLine,
			'recipientPostalCode' => $this->recipientPostalCode,
			'recipientCity' => $this->recipientCity,
			'nvit' => $this->nvit,
		);
	}
}
