<?php

namespace modules\selfserve\helpers;

enum selfserve_lane_command
{
    case START; // command to start the lane
    case STOP; // command to stop the lane
    case RESET; // command to reset the lane

    public static function tryFrom(string $commandParam): ?selfserve_lane_command
    {
        return match (strtoupper($commandParam)) {
            'START' => selfserve_lane_command::START,
            'STOP' => selfserve_lane_command::STOP,
            'RESET' => selfserve_lane_command::RESET,
            default => null,
        };
    }

    public function equals(selfserve_lane_command $command): bool
    {
        return $this === $command;
    }
}
