<?php

declare(strict_types=1);

namespace App\Framework\Queue\ValueObjects;

/**
 * Enum representing different types of job dependencies
 */
enum DependencyType: string
{
    case COMPLETION = 'completion';
    case SUCCESS = 'success';
    case CONDITIONAL = 'conditional';

    public function getDescription(): string
    {
        return match ($this) {
            self::COMPLETION => 'Job must complete (regardless of success/failure)',
            self::SUCCESS => 'Job must complete successfully',
            self::CONDITIONAL => 'Job dependency based on custom condition'
        };
    }

    public function requiresSuccessfulCompletion(): bool
    {
        return $this === self::SUCCESS;
    }

    public function allowsFailure(): bool
    {
        return $this === self::COMPLETION;
    }

    public function isConditional(): bool
    {
        return $this === self::CONDITIONAL;
    }
}
