# CVNTrade — Mailbox declarative config (Migadu).
#
# Source of truth for the @cvntrade.eu mail surface. The provisioning script
# `scripts/migadu_provision.py` reads this file and synchronises Migadu's
# state to match : creates missing mailboxes / aliases, leaves existing ones
# untouched (idempotent). It NEVER deletes — see runbook §6 for the
# decommission procedure.
#
# Adding a mailbox = edit this YAML + `make email-sync` + commit (PR review
# acts as the audit trail per CLAUDE.md workflow).
#
# Schema (v1) :
#   domain: <fqdn>
#   defaults:                    optional ; applied to every mailbox unless overridden
#     spam_action: folder | drop | none
#     storage_quota: int (bytes, 0 = unlimited)
#   mailboxes:
#     - local_part: str          REQUIRED (becomes <local_part>@<domain>)
#       name: str                REQUIRED (display name in webmail)
#       purpose: str             REQUIRED (operator-facing rationale, multiline OK)
#       spam_action: folder | drop | none   (overrides defaults)
#       forward_to: str          OPTIONAL external address (e.g. ceven@gmail.com)
#       aliases: [str]           OPTIONAL ; alias local_parts on the SAME domain
#                                that route to this mailbox
#                                (e.g. `aliases: [github, ci]` creates
#                                 github@cvntrade.eu + ci@cvntrade.eu)
#
# Migration-friendly : if we ever swap Migadu for Bluemind / Infomaniak
# / OVH / self-hosted, this YAML stays and the provisioning script gains
# an adapter. The YAML is provider-agnostic.

domain: cvntrade.eu

defaults:
  spam_action: folder       # spam → Junk folder (recoverable), not dropped
  storage_quota: 0          # 0 = unlimited within plan budget (Migadu Standard = 30 GB shared)

mailboxes:
  # -------------------------------------------------------------------------
  # admin@ — Operator account, infrastructure & billing notifications
  # -------------------------------------------------------------------------
  - local_part: admin
    name: Admin
    purpose: |
      Compte opérateur principal. Reçoit :
      - Notifications cluster (cert-manager renewals, Scaleway billing,
        OpenProject system mails)
      - Invoices Migadu + factures fournisseurs (OVH si applicable, etc.)
      - Alertes infra critiques (Grafana P1 / Prometheus P0)
      - Domain registrar correspondence (renouvellements .eu)
    # forward_to: dococeven@gmail.com   # ← optional, à activer si tu veux
                                          #    réveiller la nuit en cas
                                          #    d'incident (uncomment + mette ton
                                          #    perso ; sync re-applique).

  # -------------------------------------------------------------------------
  # dev@ — Development & technical tooling notifications
  # -------------------------------------------------------------------------
  - local_part: dev
    name: Development
    purpose: |
      Boîte "outils techniques". Reçoit :
      - GitHub notifications (PRs, issues, mentions, CR comments)
      - CodeRabbit summaries
      - GitHub Actions failures (build / test / deploy)
      - MLflow promotion notifications (post-deploy)
      - FTF run completion summaries (Airflow → mail)
      - Sentry / observability alerts (P2 / P3)
    aliases:
      - github             # github@cvntrade.eu → dev@cvntrade.eu
      - ci                 # ci@cvntrade.eu → dev@cvntrade.eu
      - sentry             # sentry@cvntrade.eu → dev@cvntrade.eu

  # -------------------------------------------------------------------------
  # trade@ — Trading-domain notifications (signals, kill-switch, deployment)
  # -------------------------------------------------------------------------
  - local_part: trade
    name: Trading
    purpose: |
      Boîte trading-domain. Reçoit :
      - Binance API status alerts (rate limits, bans, key rotation)
      - Paper-trading session summaries (daily PnL digest)
      - Kill-switch engagement events (ADR-71 ; cross-check P1 Grafana alert)
      - Deployment_review committee verdicts (post-promotion)
      - Trade execution anomalies (slippage spikes, fill failures)
    aliases:
      - alerts             # alerts@cvntrade.eu → trade@cvntrade.eu (oncall pager equivalent)
      - signals            # signals@cvntrade.eu → trade@cvntrade.eu
      - binance            # binance@cvntrade.eu → trade@cvntrade.eu (vendor-side)
