<?php

namespace modules\selfserve\traits;
require_once WD . '/modules/selfserve/helpers/selfserve_lane_status.php';
require_once WD . '/modules/selfserve/classes/selfserve_lane.php';
use modules\selfserve\classes\selfserve_lane;
use modules\selfserve\helpers\selfserve_lane_status;

trait selfserve_lane_license_plate_t
{
    const DEFAULT_LICENSE_PLATE = null;
    /**
     * The license plate of the vehicle currently in the lane
     * @var string|null $license_plate
     */
    public ?string $license_plate = null;
    /**
     * Get the license plate of the vehicle currently in the lane
     * @return string|null The license plate, or null if not set
     */
    public function getLicensePlate(): ?string
    {
        $license_plate = $this->getLaneCache($this->id, self::CACHE_SELFSERVE_LANE_KEY_LICENSE_PLATE);
        if (!empty($license_plate)) {
            $this->license_plate = $license_plate;
        }
        return $this->license_plate;
    }
    /**
     * Set the license plate of the vehicle currently in the lane
     * @param string|null $license_plate The license plate, or null to clear
     * @return selfserve_lane_license_plate_t|selfserve_lane
     */
    public function setLicensePlate(?string $license_plate): self
    {
        $this->license_plate = $license_plate;
        $this->setLaneCache($this->id, self::CACHE_SELFSERVE_LANE_KEY_LICENSE_PLATE, $this->license_plate);
        return $this;
    }
}