<?php

it('adds lane-aware scanner management and a dedicated rotate-key action', function (): void {
    $route = file_get_contents(app_path('routes/plateScannersRoute.php'));
    $scannerObject = file_get_contents(app_path('objects/plate_scanners_o.php'));

    expect($route)->not->toBeFalse();
    expect($route)->toContain("'/numberplatescanners/{id}/rotate-key'");
    expect($route)->toContain("'lane_id'");

    expect($scannerObject)->not->toBeFalse();
    expect($scannerObject)->toContain('public object_property $lane_id;');
    expect($scannerObject)->toContain('public function rotateApiKey(int $id): array');
    expect($scannerObject)->toContain('ADD COLUMN `lane_id` INT NULL AFTER `department_id`');
});

it('uses the scanner default lane before requiring an explicit lane_id in machine button webhooks', function (): void {
    $route = file_get_contents(app_path('routes/machineButtonPressRoute.php'));

    expect($route)->not->toBeFalse();
    expect($route)->toContain('$plateScanner->lane_id->value()');
    expect($route)->toContain('default lane configured for the plate scanner');
});
