<?php

namespace PostenBringCheckout\admin\bring\models\service;

defined( 'ABSPATH' ) || exit;

class MybringServiceDetails {
	public string $service_id;
	public string $name;
	public string $delivery_type;
	public int $max_weight_in_kgs;
	public ?MaxDimensions $max_dimensions       = null;
	public ?MaxEdges $max_edges                 = null;
	public ?MaxCircumference $max_circumference = null;

	public function __construct( array $data ) {
		$this->service_id        = $data['serviceId'];
		$this->name              = $data['name'];
		$this->delivery_type     = $data['deliveryType'];
		$this->max_weight_in_kgs = $data['maxWeightInKgs'];
		if ( ! empty( $data['maxDimensions'] ) ) {
			$this->max_dimensions = new MaxDimensions( $data['maxDimensions'] );
		}
		if ( ! empty( $data['maxEdges'] ) ) {
			$this->max_edges = new MaxEdges( $data['maxEdges'] );
		}
		if ( ! empty( $data['maxCircumference'] ) ) {
			$this->max_circumference = new MaxCircumference( $data['maxCircumference'] );
		}
	}
}
