TenantAtlas/app/Support/Baselines/BaselineProfileStatus.php
ahmido 7620144ab6 Spec 116: Baseline drift engine v1 (meta fidelity + coverage guard) (#141)
Implements Spec 116 baseline drift engine v1 (meta fidelity) with coverage guard, stable finding identity, and Filament UI surfaces.

Highlights
- Baseline capture/compare jobs and supporting services (meta contract hashing via InventoryMetaContract + DriftHasher)
- Coverage proof parsing + compare partial outcome behavior
- Filament pages/resources/widgets for baseline compare + drift landing improvements
- Pest tests for capture/compare/coverage guard and UI start surfaces
- Research report: docs/research/golden-master-baseline-drift-deep-analysis.md

Validation
- `vendor/bin/sail bin pint --dirty`
- `vendor/bin/sail artisan test --compact --filter="Baseline"`

Notes
- No destructive user actions added; compare/capture remain queued jobs.
- Provider registration unchanged (Laravel 11+/12 uses bootstrap/providers.php for panel providers; not touched here).

Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de>
Reviewed-on: #141
2026-03-02 22:02:58 +00:00

80 lines
1.8 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Support\Baselines;
enum BaselineProfileStatus: string
{
case Draft = 'draft';
case Active = 'active';
case Archived = 'archived';
public function label(): string
{
return match ($this) {
self::Draft => 'Draft',
self::Active => 'Active',
self::Archived => 'Archived',
};
}
/**
* Filament badge color for this status.
*/
public function color(): string
{
return match ($this) {
self::Draft => 'gray',
self::Active => 'success',
self::Archived => 'warning',
};
}
/**
* Heroicon identifier for this status.
*/
public function icon(): string
{
return match ($this) {
self::Draft => 'heroicon-m-pencil-square',
self::Active => 'heroicon-m-check-circle',
self::Archived => 'heroicon-m-archive-box',
};
}
/**
* Whether this status allows editing the profile.
*/
public function isEditable(): bool
{
return $this !== self::Archived;
}
/**
* Allowed transitions from this status.
*
* @return array<self>
*/
public function allowedTransitions(): array
{
return match ($this) {
self::Draft => [self::Draft, self::Active],
self::Active => [self::Active, self::Archived],
self::Archived => [self::Archived],
};
}
/**
* Status options for a Filament Select field, scoped to allowed transitions.
*
* @return array<string, string>
*/
public function selectOptions(): array
{
return collect($this->allowedTransitions())
->mapWithKeys(fn (self $s): array => [$s->value => $s->label()])
->all();
}
}