<?php
declare(strict_types=1);

namespace PpPhp\Core\Platform\Console;

final class CommandResult
{
    public function __construct(
        private readonly int $exitCode = 0,
        private readonly array $data = [],
        private readonly string $message = ''
    ) {}

    public function exitCode(): int { return $this->exitCode; }
    public function data(): array { return $this->data; }
    public function message(): string { return $this->message; }

    public function toArray(): array
    {
        return [
            'exitCode' => $this->exitCode,
            'message' => $this->message,
            'data' => $this->data,
        ];
    }
}
