groups:
  - name: tiku-commercial-delivery
    rules:
      - alert: TikuWorkerStale
        expr: tiku_commercial_health_stale_workers > 0
        for: 5m
        labels: { severity: critical }
        annotations:
          summary: TIKU Worker heartbeat is stale
          description: At least one Worker processor has not reported for more than three minutes.
      - alert: TikuOldestPendingJob
        expr: tiku_commercial_health_oldest_pending_job_seconds > 300
        for: 10m
        labels: { severity: warning }
        annotations:
          summary: TIKU PostgreSQL job queue is delayed
          description: The oldest pending background job has waited for more than five minutes.
      - alert: TikuPaymentCallbackFailures
        expr: tiku_commercial_health_payment_callback_failures_5m > 0
        for: 2m
        labels: { severity: critical }
        annotations:
          summary: TIKU SaaS payment callbacks are failing
          description: One or more audited payment callback scopes failed in the last five minutes.
      - alert: TikuOverdueReceivables
        expr: tiku_commercial_health_overdue_receivables > 0
        for: 30m
        labels: { severity: warning }
        annotations:
          summary: TIKU has overdue SaaS receivables
          description: Review the subscription and receivable workbench for outstanding tenant balances.
      - alert: TikuDunningDeadLetters
        expr: tiku_commercial_health_dunning_dead_letters > 0
        for: 5m
        labels: { severity: critical }
        annotations:
          summary: TIKU dunning delivery exhausted all retries
          description: At least one dunning notification needs manual retry, confirmation, or ignore handling.
