STANDARD_ROLES = [
    {
        "name": "administrator",
        "display_name": "Administrator",
        "description": "Vollzugriff auf Olympus CRM",
        "is_system": True,
    },
    {
        "name": "management",
        "display_name": "Management",
        "description": "Lesender Zugriff auf operative Kernmodule",
        "is_system": True,
    },
    {
        "name": "sales",
        "display_name": "Vertrieb",
        "description": "Zugriff auf Kunden und Projekte",
        "is_system": True,
    },
    {
        "name": "technician",
        "display_name": "Technik",
        "description": "Zugriff auf Tickets und Projekte",
        "is_system": True,
    },
    {
        "name": "support",
        "display_name": "Support",
        "description": "Operativer Support-Zugriff",
        "is_system": True,
    },
    {
        "name": "warehouse",
        "display_name": "Lager",
        "description": "Zugriff auf lagernahe Prozesse",
        "is_system": True,
    },
    {
        "name": "guest",
        "display_name": "Gast",
        "description": "Minimaler Zugriff",
        "is_system": True,
    },
]

STANDARD_PERMISSIONS = [
    ("users.read", "Benutzer lesen", "Benutzer anzeigen", "users"),
    ("users.create", "Benutzer erstellen", "Benutzer anlegen", "users"),
    ("users.update", "Benutzer bearbeiten", "Benutzer aktualisieren", "users"),
    ("users.delete", "Benutzer loeschen", "Benutzer entfernen", "users"),
    ("users.password.update", "Passwort aendern", "Benutzerpasswort aendern", "users"),
    ("roles.read", "Rollen lesen", "Rollen anzeigen", "roles"),
    ("roles.create", "Rollen erstellen", "Rollen anlegen", "roles"),
    ("roles.update", "Rollen bearbeiten", "Rollen aktualisieren", "roles"),
    ("roles.delete", "Rollen loeschen", "Rollen entfernen", "roles"),
    ("roles.assign", "Rollen zuweisen", "Berechtigungen Rollen zuweisen", "roles"),
    ("customers.read", "Kunden lesen", "Kunden anzeigen", "customers"),
    ("customers.create", "Kunden erstellen", "Kunden anlegen", "customers"),
    ("customers.update", "Kunden bearbeiten", "Kunden aktualisieren", "customers"),
    ("customers.delete", "Kunden loeschen", "Kunden entfernen", "customers"),
    ("projects.read", "Projekte lesen", "Projekte anzeigen", "projects"),
    ("projects.create", "Projekte erstellen", "Projekte anlegen", "projects"),
    ("projects.update", "Projekte bearbeiten", "Projekte aktualisieren", "projects"),
    ("projects.delete", "Projekte loeschen", "Projekte entfernen", "projects"),
    ("tickets.read", "Tickets lesen", "Tickets anzeigen", "tickets"),
    ("tickets.create", "Tickets erstellen", "Tickets anlegen", "tickets"),
    ("tickets.update", "Tickets bearbeiten", "Tickets aktualisieren", "tickets"),
    ("tickets.delete", "Tickets loeschen", "Tickets entfernen", "tickets"),
    ("dashboard.read", "Dashboard lesen", "Dashboard anzeigen", "dashboard"),
    ("system.settings.read", "Einstellungen lesen", "Systemeinstellungen anzeigen", "system"),
    ("system.settings.update", "Einstellungen bearbeiten", "Systemeinstellungen aktualisieren", "system"),
    ("audit_logs.read", "Audit Logs lesen", "Audit Logs anzeigen", "audit_logs"),
    ("knowledge.read", "Wissen lesen", "Wissensdatenbank anzeigen", "knowledge"),
    ("knowledge.create", "Wissen erstellen", "Wissensdatenbank-Einträge erstellen", "knowledge"),
    ("knowledge.update", "Wissen bearbeiten", "Wissensdatenbank-Einträge aktualisieren", "knowledge"),
    ("knowledge.delete", "Wissen löschen", "Wissensdatenbank-Einträge entfernen", "knowledge"),
    ("knowledge.upload", "Wissen hochladen", "Wissensdokumente hochladen", "knowledge"),
    ("knowledge.download", "Wissen herunterladen", "Wissensdokumente herunterladen", "knowledge"),
    ("repairs.read", "Reparaturen lesen", "Reparaturen anzeigen", "repairs"),
    ("repairs.create", "Reparaturen erstellen", "Reparaturen anlegen", "repairs"),
    ("repairs.update", "Reparaturen bearbeiten", "Reparaturen aktualisieren", "repairs"),
    ("repairs.delete", "Reparaturen löschen", "Reparaturen stornieren", "repairs"),
    ("repairs.status.update", "Reparaturstatus ändern", "Status von Reparaturen ändern", "repairs"),
    ("repairs.intake", "Reparatur-Intake", "Website-Reparaturanfragen übernehmen", "repairs"),
    ("repairs.assign", "Reparaturen zuweisen", "Reparaturen Benutzern zuweisen", "repairs"),
    ("repairs.public_link.manage", "Reparatur-Statuslinks verwalten", "Öffentliche Statuslinks für Reparaturen verwalten", "repairs"),
]

ROLE_PERMISSION_NAMES = {
    "administrator": "*",
    "management": {
        "dashboard.read",
        "users.read",
        "customers.read",
        "knowledge.read",
        "knowledge.download",
        "projects.read",
        "tickets.read",
        "repairs.read",
        "repairs.create",
        "repairs.update",
        "repairs.status.update",
        "repairs.public_link.manage",
    },
    "sales": {
        "dashboard.read",
        "customers.read",
        "customers.create",
        "customers.update",
        "projects.read",
        "tickets.read",
    },
    "technician": {
        "dashboard.read",
        "projects.read",
        "tickets.read",
        "tickets.create",
        "tickets.update",
        "knowledge.read",
        "knowledge.create",
        "knowledge.update",
        "knowledge.upload",
        "knowledge.download",
        "repairs.read",
        "repairs.update",
        "repairs.status.update",
    },
    "support": {
        "dashboard.read",
        "users.read",
        "customers.read",
        "knowledge.read",
        "knowledge.download",
        "tickets.read",
        "tickets.create",
        "tickets.update",
        "repairs.read",
        "repairs.create",
        "repairs.update",
        "repairs.status.update",
        "repairs.intake",
        "repairs.public_link.manage",
    },
    "warehouse": {
        "dashboard.read",
    },
    "guest": {
        "dashboard.read",
    },
}
