'Infra', 'support' => 'Support', 'metier' => 'Métier', 'autre' => 'Autre', ]; const CRITICALITIES = [ 'low' => 'Basse', 'medium' => 'Moyenne', 'high' => 'Haute', 'urgent' => 'Urgente', ]; protected function casts(): array { return [ 'due_date' => 'date', 'is_done' => 'boolean', 'completed_at' => 'datetime', ]; } public function organization() { return $this->belongsTo(Organization::class); } public function assignee() { return $this->belongsTo(User::class, 'assigned_to'); } public function creator() { return $this->belongsTo(User::class, 'created_by'); } public function categoryLabel(): string { return self::CATEGORIES[$this->category] ?? $this->category; } public function criticalityLabel(): string { return self::CRITICALITIES[$this->criticality] ?? $this->criticality; } public function isOverdue(): bool { return ! $this->is_done && $this->due_date && $this->due_date->isPast(); } public function linkableKind(): string { return 'Todo'; } public function linkableLabel(): string { return $this->title; } public function linkableUrl(): string { return route('organizations.todos.edit', [$this->organization_id, $this]); } }