major update
This commit is contained in:
33
lib/Domain/Taxonomy/ImportAuditStatus.php
Normal file
33
lib/Domain/Taxonomy/ImportAuditStatus.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Domain\Taxonomy;
|
||||
|
||||
enum ImportAuditStatus: string
|
||||
{
|
||||
use SupportsStringTaxonomy;
|
||||
|
||||
case Running = 'running';
|
||||
case Success = 'success';
|
||||
case Partial = 'partial';
|
||||
case Failed = 'failed';
|
||||
|
||||
public function labelToken(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Running => 'Running',
|
||||
self::Success => 'Success',
|
||||
self::Partial => 'Partial',
|
||||
self::Failed => 'Failed',
|
||||
};
|
||||
}
|
||||
|
||||
public function badgeVariant(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Running => 'info',
|
||||
self::Success => 'success',
|
||||
self::Partial => 'warning',
|
||||
self::Failed => 'danger',
|
||||
};
|
||||
}
|
||||
}
|
||||
30
lib/Domain/Taxonomy/MailLogStatus.php
Normal file
30
lib/Domain/Taxonomy/MailLogStatus.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Domain\Taxonomy;
|
||||
|
||||
enum MailLogStatus: string
|
||||
{
|
||||
use SupportsStringTaxonomy;
|
||||
|
||||
case Queued = 'queued';
|
||||
case Sent = 'sent';
|
||||
case Failed = 'failed';
|
||||
|
||||
public function labelToken(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Queued => 'Queued',
|
||||
self::Sent => 'Sent',
|
||||
self::Failed => 'Failed',
|
||||
};
|
||||
}
|
||||
|
||||
public function badgeVariant(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Queued => 'info',
|
||||
self::Sent => 'success',
|
||||
self::Failed => 'danger',
|
||||
};
|
||||
}
|
||||
}
|
||||
30
lib/Domain/Taxonomy/ScheduledJobRunStatus.php
Normal file
30
lib/Domain/Taxonomy/ScheduledJobRunStatus.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Domain\Taxonomy;
|
||||
|
||||
enum ScheduledJobRunStatus: string
|
||||
{
|
||||
use SupportsStringTaxonomy;
|
||||
|
||||
case Success = 'success';
|
||||
case Failed = 'failed';
|
||||
case Skipped = 'skipped';
|
||||
|
||||
public function labelToken(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Success => 'Success',
|
||||
self::Failed => 'Failed',
|
||||
self::Skipped => 'Skipped',
|
||||
};
|
||||
}
|
||||
|
||||
public function badgeVariant(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Success => 'success',
|
||||
self::Failed => 'danger',
|
||||
self::Skipped => 'warning',
|
||||
};
|
||||
}
|
||||
}
|
||||
33
lib/Domain/Taxonomy/ScheduledJobStatus.php
Normal file
33
lib/Domain/Taxonomy/ScheduledJobStatus.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Domain\Taxonomy;
|
||||
|
||||
enum ScheduledJobStatus: string
|
||||
{
|
||||
use SupportsStringTaxonomy;
|
||||
|
||||
case Running = 'running';
|
||||
case Success = 'success';
|
||||
case Failed = 'failed';
|
||||
case Skipped = 'skipped';
|
||||
|
||||
public function labelToken(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Running => 'Running',
|
||||
self::Success => 'Success',
|
||||
self::Failed => 'Failed',
|
||||
self::Skipped => 'Skipped',
|
||||
};
|
||||
}
|
||||
|
||||
public function badgeVariant(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Running => 'info',
|
||||
self::Success => 'success',
|
||||
self::Failed => 'danger',
|
||||
self::Skipped => 'warning',
|
||||
};
|
||||
}
|
||||
}
|
||||
27
lib/Domain/Taxonomy/ScheduledJobTriggerType.php
Normal file
27
lib/Domain/Taxonomy/ScheduledJobTriggerType.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Domain\Taxonomy;
|
||||
|
||||
enum ScheduledJobTriggerType: string
|
||||
{
|
||||
use SupportsStringTaxonomy;
|
||||
|
||||
case Scheduler = 'scheduler';
|
||||
case Manual = 'manual';
|
||||
|
||||
public function labelToken(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Scheduler => 'Scheduler',
|
||||
self::Manual => 'Manual',
|
||||
};
|
||||
}
|
||||
|
||||
public function badgeVariant(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Scheduler => 'neutral',
|
||||
self::Manual => 'info',
|
||||
};
|
||||
}
|
||||
}
|
||||
30
lib/Domain/Taxonomy/SchedulerRuntimeResult.php
Normal file
30
lib/Domain/Taxonomy/SchedulerRuntimeResult.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Domain\Taxonomy;
|
||||
|
||||
enum SchedulerRuntimeResult: string
|
||||
{
|
||||
use SupportsStringTaxonomy;
|
||||
|
||||
case Ok = 'ok';
|
||||
case LockNotAcquired = 'lock_not_acquired';
|
||||
case UnexpectedError = 'unexpected_error';
|
||||
|
||||
public function labelToken(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Ok => 'OK',
|
||||
self::LockNotAcquired => 'Lock not acquired',
|
||||
self::UnexpectedError => 'Unexpected error',
|
||||
};
|
||||
}
|
||||
|
||||
public function badgeVariant(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Ok => 'success',
|
||||
self::LockNotAcquired => 'warning',
|
||||
self::UnexpectedError => 'danger',
|
||||
};
|
||||
}
|
||||
}
|
||||
38
lib/Domain/Taxonomy/SupportsStringTaxonomy.php
Normal file
38
lib/Domain/Taxonomy/SupportsStringTaxonomy.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Domain\Taxonomy;
|
||||
|
||||
trait SupportsStringTaxonomy
|
||||
{
|
||||
/**
|
||||
* @return list<string>
|
||||
*/
|
||||
public static function values(): array
|
||||
{
|
||||
return array_map(
|
||||
static fn (self $case): string => $case->value,
|
||||
self::cases()
|
||||
);
|
||||
}
|
||||
|
||||
public static function tryNormalize(string $value): ?self
|
||||
{
|
||||
$value = strtolower(trim($value));
|
||||
if ($value === '') {
|
||||
return null;
|
||||
}
|
||||
|
||||
foreach (self::cases() as $case) {
|
||||
if (strtolower($case->value) === $value) {
|
||||
return $case;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function normalizeOr(string $value, self $fallback): self
|
||||
{
|
||||
return self::tryNormalize($value) ?? $fallback;
|
||||
}
|
||||
}
|
||||
33
lib/Domain/Taxonomy/SystemAuditChannel.php
Normal file
33
lib/Domain/Taxonomy/SystemAuditChannel.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Domain\Taxonomy;
|
||||
|
||||
enum SystemAuditChannel: string
|
||||
{
|
||||
use SupportsStringTaxonomy;
|
||||
|
||||
case Web = 'web';
|
||||
case Api = 'api';
|
||||
case Scheduler = 'scheduler';
|
||||
case Cli = 'cli';
|
||||
|
||||
public function labelToken(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Web => 'Web',
|
||||
self::Api => 'API',
|
||||
self::Scheduler => 'Scheduler',
|
||||
self::Cli => 'CLI',
|
||||
};
|
||||
}
|
||||
|
||||
public function badgeVariant(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Web => 'neutral',
|
||||
self::Api => 'info',
|
||||
self::Scheduler => 'warning',
|
||||
self::Cli => 'neutral',
|
||||
};
|
||||
}
|
||||
}
|
||||
30
lib/Domain/Taxonomy/SystemAuditOutcome.php
Normal file
30
lib/Domain/Taxonomy/SystemAuditOutcome.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Domain\Taxonomy;
|
||||
|
||||
enum SystemAuditOutcome: string
|
||||
{
|
||||
use SupportsStringTaxonomy;
|
||||
|
||||
case Success = 'success';
|
||||
case Failed = 'failed';
|
||||
case Denied = 'denied';
|
||||
|
||||
public function labelToken(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Success => 'Success',
|
||||
self::Failed => 'Failed',
|
||||
self::Denied => 'Denied',
|
||||
};
|
||||
}
|
||||
|
||||
public function badgeVariant(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Success => 'success',
|
||||
self::Failed => 'danger',
|
||||
self::Denied => 'warning',
|
||||
};
|
||||
}
|
||||
}
|
||||
27
lib/Domain/Taxonomy/TenantStatus.php
Normal file
27
lib/Domain/Taxonomy/TenantStatus.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Domain\Taxonomy;
|
||||
|
||||
enum TenantStatus: string
|
||||
{
|
||||
use SupportsStringTaxonomy;
|
||||
|
||||
case Active = 'active';
|
||||
case Inactive = 'inactive';
|
||||
|
||||
public function labelToken(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Active => 'Active',
|
||||
self::Inactive => 'Inactive',
|
||||
};
|
||||
}
|
||||
|
||||
public function badgeVariant(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Active => 'success',
|
||||
self::Inactive => 'danger',
|
||||
};
|
||||
}
|
||||
}
|
||||
30
lib/Domain/Taxonomy/UserLifecycleAction.php
Normal file
30
lib/Domain/Taxonomy/UserLifecycleAction.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Domain\Taxonomy;
|
||||
|
||||
enum UserLifecycleAction: string
|
||||
{
|
||||
use SupportsStringTaxonomy;
|
||||
|
||||
case Deactivate = 'deactivate';
|
||||
case Delete = 'delete';
|
||||
case Restore = 'restore';
|
||||
|
||||
public function labelToken(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Deactivate => 'Deactivate',
|
||||
self::Delete => 'Delete',
|
||||
self::Restore => 'Restore',
|
||||
};
|
||||
}
|
||||
|
||||
public function badgeVariant(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Deactivate => 'warning',
|
||||
self::Delete => 'danger',
|
||||
self::Restore => 'success',
|
||||
};
|
||||
}
|
||||
}
|
||||
30
lib/Domain/Taxonomy/UserLifecycleStatus.php
Normal file
30
lib/Domain/Taxonomy/UserLifecycleStatus.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Domain\Taxonomy;
|
||||
|
||||
enum UserLifecycleStatus: string
|
||||
{
|
||||
use SupportsStringTaxonomy;
|
||||
|
||||
case Success = 'success';
|
||||
case Skipped = 'skipped';
|
||||
case Failed = 'failed';
|
||||
|
||||
public function labelToken(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Success => 'Success',
|
||||
self::Skipped => 'Skipped',
|
||||
self::Failed => 'Failed',
|
||||
};
|
||||
}
|
||||
|
||||
public function badgeVariant(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Success => 'success',
|
||||
self::Skipped => 'warning',
|
||||
self::Failed => 'danger',
|
||||
};
|
||||
}
|
||||
}
|
||||
30
lib/Domain/Taxonomy/UserLifecycleTriggerType.php
Normal file
30
lib/Domain/Taxonomy/UserLifecycleTriggerType.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Domain\Taxonomy;
|
||||
|
||||
enum UserLifecycleTriggerType: string
|
||||
{
|
||||
use SupportsStringTaxonomy;
|
||||
|
||||
case Manual = 'manual';
|
||||
case Cron = 'cron';
|
||||
case System = 'system';
|
||||
|
||||
public function labelToken(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Manual => 'Manual',
|
||||
self::Cron => 'Cron',
|
||||
self::System => 'System',
|
||||
};
|
||||
}
|
||||
|
||||
public function badgeVariant(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Manual => 'info',
|
||||
self::Cron => 'neutral',
|
||||
self::System => 'warning',
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user