- Move 12 markdown files from root to docs/ subdirectories - Organize documentation by category: • docs/troubleshooting/ (1 file) - Technical troubleshooting guides • docs/deployment/ (4 files) - Deployment and security documentation • docs/guides/ (3 files) - Feature-specific guides • docs/planning/ (4 files) - Planning and improvement proposals Root directory cleanup: - Reduced from 16 to 4 markdown files in root - Only essential project files remain: • CLAUDE.md (AI instructions) • README.md (Main project readme) • CLEANUP_PLAN.md (Current cleanup plan) • SRC_STRUCTURE_IMPROVEMENTS.md (Structure improvements) This improves: ✅ Documentation discoverability ✅ Logical organization by purpose ✅ Clean root directory ✅ Better maintainability
110 lines
2.8 KiB
PHP
110 lines
2.8 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Framework\Queue\ValueObjects;
|
|
|
|
/**
|
|
* Enum representing job priority levels
|
|
*/
|
|
enum JobPriority: int
|
|
{
|
|
case LOW = 1;
|
|
case NORMAL = 5;
|
|
case HIGH = 10;
|
|
case URGENT = 20;
|
|
case CRITICAL = 50;
|
|
|
|
public function getDisplayName(): string
|
|
{
|
|
return match ($this) {
|
|
self::LOW => 'Low',
|
|
self::NORMAL => 'Normal',
|
|
self::HIGH => 'High',
|
|
self::URGENT => 'Urgent',
|
|
self::CRITICAL => 'Critical'
|
|
};
|
|
}
|
|
|
|
public function getIcon(): string
|
|
{
|
|
return match ($this) {
|
|
self::LOW => '🔵',
|
|
self::NORMAL => '⚪',
|
|
self::HIGH => '🟡',
|
|
self::URGENT => '🟠',
|
|
self::CRITICAL => '🔴'
|
|
};
|
|
}
|
|
|
|
public function getColor(): string
|
|
{
|
|
return match ($this) {
|
|
self::LOW => 'blue',
|
|
self::NORMAL => 'gray',
|
|
self::HIGH => 'yellow',
|
|
self::URGENT => 'orange',
|
|
self::CRITICAL => 'red'
|
|
};
|
|
}
|
|
|
|
public function isHigherThan(self $other): bool
|
|
{
|
|
return $this->value > $other->value;
|
|
}
|
|
|
|
public function isLowerThan(self $other): bool
|
|
{
|
|
return $this->value < $other->value;
|
|
}
|
|
|
|
public function equals(self $other): bool
|
|
{
|
|
return $this->value === $other->value;
|
|
}
|
|
|
|
public static function fromString(string $priority): self
|
|
{
|
|
return match (strtolower($priority)) {
|
|
'low' => self::LOW,
|
|
'normal' => self::NORMAL,
|
|
'high' => self::HIGH,
|
|
'urgent' => self::URGENT,
|
|
'critical' => self::CRITICAL,
|
|
default => throw new \InvalidArgumentException("Invalid priority: {$priority}")
|
|
};
|
|
}
|
|
|
|
public function getDescription(): string
|
|
{
|
|
return match ($this) {
|
|
self::LOW => 'Low priority - process when system is idle',
|
|
self::NORMAL => 'Normal priority - standard processing',
|
|
self::HIGH => 'High priority - expedited processing',
|
|
self::URGENT => 'Urgent priority - immediate attention required',
|
|
self::CRITICAL => 'Critical priority - highest precedence'
|
|
};
|
|
}
|
|
|
|
public function getMaxRetries(): int
|
|
{
|
|
return match ($this) {
|
|
self::LOW => 2,
|
|
self::NORMAL => 3,
|
|
self::HIGH => 5,
|
|
self::URGENT => 8,
|
|
self::CRITICAL => 10
|
|
};
|
|
}
|
|
|
|
public function getTimeoutSeconds(): int
|
|
{
|
|
return match ($this) {
|
|
self::LOW => 300, // 5 minutes
|
|
self::NORMAL => 600, // 10 minutes
|
|
self::HIGH => 900, // 15 minutes
|
|
self::URGENT => 1800, // 30 minutes
|
|
self::CRITICAL => 3600 // 60 minutes
|
|
};
|
|
}
|
|
} |