<?php

namespace modules\selfserve\classes;

class selfserve_lane_command_arguments
{
    public ?string $license_plate = null;
    public ?int $customer_number = null;

    /**
     * Set the license plate of the vehicle currently in the lane
     * @param string|null $license_plate
     * @return $this
     */
    public function setLicensePlate(?string $license_plate): self
    {
        $this->license_plate = $license_plate ? strtoupper(trim($license_plate)) : null;
        return $this;
    }

    public function setCustomerNumber(?int $customer_number): self
    {
        $this->customer_number = $customer_number;
        return $this;
    }

    public function setParameters($params): self
    {
        if (is_array($params)) {
            if (array_key_exists('license_plate', $params)) {
                $this->setLicensePlate($params['license_plate']);
            }
            if (array_key_exists('customer_number', $params)) {
                $this->setCustomerNumber($params['customer_number']);
            }
        }
        return $this;
    }
}