"""Mapeamento Desk role → grupos Odoo 16 (Spec 027 contrato §3)."""

from __future__ import annotations

# XML IDs standard Odoo 16 — requerem apps instaladas (sale, account, …)
DESK_ROLE_ODOO_XMLIDS: dict[str, tuple[str, ...]] = {
    "sales_admin": ("sales_team.group_sale_manager",),
    "sales_support": ("sales_team.group_sale_salesman",),
    "finance": (
        "account.group_account_invoice",
        "account.group_account_manager",
    ),
    "marketing": ("sales_team.group_sale_salesman",),  # CRM + leads (Odoo CRM app)
    "super_admin": ("base.group_system",),
}

# Fallback search por nome quando módulo ainda não tem ir.model.data (dev)
DESK_ROLE_ODOO_GROUP_NAMES: dict[str, tuple[str, ...]] = {
    "sales_admin": ("Sales / Manager", "User: Own Documents Only"),
    "sales_support": ("Sales / User: Own Documents Only", "User: Own Documents Only"),
    "finance": ("Billing", "Billing Administrator"),
}

PROVISIONABLE_DESK_ROLES = frozenset(
    {"sales_admin", "sales_support", "finance", "marketing", "developer"}
)
FOSS_GROUP_BY_ROLE: dict[str, str] = {
    "sales_admin": "ligbox-sales-admin",
    "sales_support": "ligbox-sales-support",
    "finance": "ligbox-finance-admin",
    "marketing": "ligbox-marketing",
    "developer": "ligbox-dev-api",
}
