<?php

declare(strict_types=1);

namespace App\Framework\Console\Result;

use App\Framework\Console\ConsoleOutputInterface;
use App\Framework\Console\ExitCode;

/**
 * Console Result Interface
 *
 * Represents the result of a console command execution.
 * Similar to HTTP ActionResult, but for console output.
 *
 * Results are value objects that encapsulate:
 * - Exit code (success/failure)
 * - Rendering logic
 * - Metadata for testing/introspection
 */
interface ConsoleResult
{
    /**
     * Exit code for this result
     *
     * Determines the process exit code (0 = success, >0 = failure)
     */
    public ExitCode $exitCode { get; }

    /**
     * Metadata for testing/introspection
     *
     * Returns array with result data that can be inspected in tests.
     * Useful for asserting on result contents without rendering.
     *
     * @return array<string, mixed>
     */
    public array $data { get; }

    /**
     * Render result to console output
     *
     * Implementations should write to the provided output interface.
     */
    public function render(ConsoleOutputInterface $output): void;
}
