phpvms/app/Enums/PirepPhase.php
Nabeel Shahzad cbb1d85cef
feat(livemap): serve the live map from a pirep_positions table
The map resolved the newest acars breadcrumb per flight on every poll, over a
table that grows for the life of the install and was never pruned. One row per
flight replaces that, and its presence is what puts a flight on the map — no
state filter, no time arithmetic on the read path.

Prefile opens the row at the departure gate, the ACARS batch endpoint maintains
it, and a five-minute cron owns eviction. acars.live_time did two unrelated jobs
and is split into pireps.tombstone_time plus two live map timers.

Also closes the child-record gap PirepService::delete() has claimed to handle
since it was written: acars rows are now deleted, with a cascading foreign key
behind it. Adding that constraint permanently purges pre-existing orphans.
2026-07-27 03:14:23 -05:00

69 lines
2.4 KiB
PHP

<?php
namespace App\Enums;
use App\Enums\Concerns\HasSelect;
use Filament\Support\Contracts\HasLabel;
enum PirepPhase: string implements HasLabel
{
use HasSelect;
case INITIATED = 'INI';
case SCHEDULED = 'SCH';
case BOARDING = 'BST';
case RDY_START = 'RDT';
case PUSHBACK_TOW = 'PBT';
case DEPARTED = 'OFB';
case RDY_DEICE = 'DIR';
case STRT_DEICE = 'DIC';
case GRND_RTRN = 'GRT';
case TAXI = 'TXI';
case TAKEOFF = 'TOF';
case INIT_CLIM = 'ICL';
case AIRBORNE = 'TKO';
case ENROUTE = 'ENR';
case DIVERTED = 'DV';
case APPROACH = 'TEN';
case APPROACH_ICAO = 'APR';
case ON_FINAL = 'FIN';
case LANDING = 'LDG';
case LANDED = 'LAN';
case ON_BLOCK = 'ONB';
case ARRIVED = 'ARR';
case CANCELLED = 'DX';
case EMERG_DESCENT = 'EMG';
case PAUSED = 'PSD';
public function getLabel(): string
{
return match ($this) {
self::INITIATED => __('pireps.status.initialized'),
self::SCHEDULED => __('pireps.status.scheduled'),
self::BOARDING => __('pireps.status.boarding'),
self::RDY_START => __('pireps.status.ready_start'),
self::PUSHBACK_TOW => __('pireps.status.push_tow'),
self::DEPARTED => __('pireps.status.departed'),
self::RDY_DEICE => __('pireps.status.ready_deice'),
self::STRT_DEICE => __('pireps.status.deicing'),
self::GRND_RTRN => __('pireps.status.ground_ret'),
self::TAXI => __('pireps.status.taxi'),
self::TAKEOFF => __('pireps.status.takeoff'),
self::INIT_CLIM => __('pireps.status.initial_clb'),
self::AIRBORNE,
self::ENROUTE => __('pireps.status.enroute'),
self::DIVERTED => __('pireps.status.diverted'),
self::APPROACH,
self::APPROACH_ICAO => __('pireps.status.approach'),
self::ON_FINAL => __('pireps.status.final_appr'),
self::LANDING => __('pireps.status.landing'),
self::LANDED => __('pireps.status.landed'),
self::ON_BLOCK,
self::ARRIVED => __('pireps.status.arrived'),
self::CANCELLED => __('pireps.status.cancelled'),
self::EMERG_DESCENT => __('pireps.status.emerg_decent'),
self::PAUSED => __('pireps.status.paused'),
};
}
}