<?php
declare(strict_types=1);

namespace PpPhp\Core\Platform\Console\Commands;

use PpPhp\Core\Platform\Console\AbstractCommand;

final class WorkerMonitorLockCommand extends AbstractCommand
{
    public function name(): string { return 'worker:monitor:lock'; }
    public function description(): string { return 'PPphp Worker Monitoring Lock'; }

    public function handle(array $arguments = []): int
    {
        $this->title('PPphp Worker Monitoring Lock');
        $base = \PpPhp\Core\Platform\Console\ConsolePath::basePath(); $verifier = new \PpPhp\Core\Platform\Event\Worker\Monitoring\Validation\WorkerMonitoringVerifier(); $result = $verifier->verify($base); $lock = (new \PpPhp\Core\Platform\Event\Worker\Monitoring\Lock\WorkerMonitoringLockGenerator())->generate($base, $result); $this->line('Status: ' . ($result['ok'] ? 'LOCKED' : 'FAILED')); $this->line('Score: ' . ($result['summary']['score'] ?? 0) . '%'); $this->line('File: ' . str_replace($base . '/', '', $lock)); return $result['ok'] ? 0 : 1;
        return 0;
    }
}
