<?php

declare(strict_types=1);

namespace App\Services\Supplier;

use Symfony\Component\Process\Process;

/**
 * Production Process wrapper. Делегирует все методы в Symfony\Process.
 */
final class SymfonyPlaywrightProcessHandle implements PlaywrightProcessHandle
{
    public function __construct(private readonly Process $process) {}

    public function setInput(string $input): self
    {
        $this->process->setInput($input);

        return $this;
    }

    public function setTimeoutSeconds(int $seconds): self
    {
        $this->process->setTimeout($seconds);

        return $this;
    }

    public function run(): int
    {
        return $this->process->run();
    }

    public function isSuccessful(): bool
    {
        return $this->process->isSuccessful();
    }

    public function getOutput(): string
    {
        return $this->process->getOutput();
    }

    public function getErrorOutput(): string
    {
        return $this->process->getErrorOutput();
    }

    public function getExitCode(): int
    {
        return $this->process->getExitCode() ?? -1;
    }
}
