<?php

declare(strict_types=1);

namespace App\Framework\Console;

use Attribute;

/**
 * Attribute to define command workflows for automated sequences
 */
#[Attribute(Attribute::TARGET_METHOD)]
final readonly class CommandWorkflow
{
    public function __construct(
        public string $name,
        public string $description = '',
        public array $steps = [],
        public array $prerequisites = [],
        public bool $stopOnError = true,
        public array $rollbackSteps = [],
        public int $timeoutSeconds = 300,
        public array $environment = []
    ) {
    }

    /**
     * Get workflow name
     */
    public function getName(): string
    {
        return $this->name;
    }

    /**
     * Get workflow description
     */
    public function getDescription(): string
    {
        return $this->description;
    }

    /**
     * Get workflow steps
     */
    public function getSteps(): array
    {
        return $this->steps;
    }

    /**
     * Get prerequisites
     */
    public function getPrerequisites(): array
    {
        return $this->prerequisites;
    }

    /**
     * Check if workflow should stop on error
     */
    public function shouldStopOnError(): bool
    {
        return $this->stopOnError;
    }

    /**
     * Get rollback steps
     */
    public function getRollbackSteps(): array
    {
        return $this->rollbackSteps;
    }

    /**
     * Get timeout in seconds
     */
    public function getTimeoutSeconds(): int
    {
        return $this->timeoutSeconds;
    }

    /**
     * Get environment variables
     */
    public function getEnvironment(): array
    {
        return $this->environment;
    }
}
