'required|integer', 'chart_id' => 'required|integer', 'name' => 'required|min_length[2]|max_length[200]', 'metric_field' => 'required|max_length[150]', 'condition' => 'required|in_list[gt,lt,eq,gte,lte]', 'threshold' => 'required|decimal', ]; public function forWorkspace(int $workspaceId): array { return $this->select('alerts.*, charts.name AS chart_name') ->join('charts', 'charts.id = alerts.chart_id', 'left') ->where('alerts.workspace_id', $workspaceId) ->orderBy('alerts.id', 'DESC') ->findAll(); } /** * Active alerts across all workspaces (for cron). * * @return list> */ public function allActiveForEngine(): array { return $this->where('is_active', 1)->findAll(); } }