<?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_customer_number_t
{
    const DEFAULT_CUSTOMER_NUMBER = null;
    /**
     * The billable customer number associated with the current wash
     * @var int|null $customer_number
     */
    public ?int $customer_number = null;
    /**
     * Get the customer number associated with the current wash
     * @return int|null The customer number, or null if not set
     */
    public function getCustomerNumber(): ?int
    {
        $customer_number = $this->getLaneCache($this->id, self::CACHE_SELFSERVE_LANE_KEY_CUSTOMER_NUMBER);
        if (!empty($customer_number)) {
            $this->customer_number = $customer_number;
        }
        return $this->customer_number;
    }
    /**
     * Set the customer number associated with the current wash
     * @param int|null $customer_number The customer number, or null to clear
     * @return selfserve_lane_customer_number_t|selfserve_lane
     */
    public function setCustomerNumber(?int $customer_number): self
    {
        $this->customer_number = $customer_number;
        $this->setLaneCache($this->id, self::CACHE_SELFSERVE_LANE_KEY_CUSTOMER_NUMBER, $this->customer_number);
        return $this;
    }
}