<?php

namespace PostenBringCheckout\admin\api\models;

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

class OrderRequestPackage {
	public float $weight;
	public ?OrderRequestDimensions $dimensions;

	public function __construct( array $data ) {
		$this->weight     = $data['weightInKg'] ? max($data['weightInKg'], 0.1) : 0.1;
		$this->dimensions = isset( $data['dimensions'] ) ? new OrderRequestDimensions( $data['dimensions'] ) : null;
	}
}
