"""Experience permission definitions — Phase 11.0 foundation."""
from __future__ import annotations

EXPERIENCE_VIEW = "experience.view"
EXPERIENCE_MANAGE = "experience.manage"

WORKSPACES_VIEW = "experience.workspaces.view"
WORKSPACES_CREATE = "experience.workspaces.create"
WORKSPACES_UPDATE = "experience.workspaces.update"
WORKSPACES_DELETE = "experience.workspaces.delete"
WORKSPACES_MANAGE = "experience.workspaces.manage"

LOCALE_PROFILES_VIEW = "experience.locale_profiles.view"
LOCALE_PROFILES_CREATE = "experience.locale_profiles.create"
LOCALE_PROFILES_UPDATE = "experience.locale_profiles.update"
LOCALE_PROFILES_DELETE = "experience.locale_profiles.delete"
LOCALE_PROFILES_MANAGE = "experience.locale_profiles.manage"

EXTERNAL_PROVIDERS_VIEW = "experience.external_providers.view"
EXTERNAL_PROVIDERS_CREATE = "experience.external_providers.create"
EXTERNAL_PROVIDERS_UPDATE = "experience.external_providers.update"
EXTERNAL_PROVIDERS_DELETE = "experience.external_providers.delete"
EXTERNAL_PROVIDERS_MANAGE = "experience.external_providers.manage"

RENDER_ENGINES_VIEW = "experience.render_engines.view"
RENDER_ENGINES_CREATE = "experience.render_engines.create"
RENDER_ENGINES_UPDATE = "experience.render_engines.update"
RENDER_ENGINES_DELETE = "experience.render_engines.delete"
RENDER_ENGINES_MANAGE = "experience.render_engines.manage"

CONFIGURATIONS_VIEW = "experience.configurations.view"
CONFIGURATIONS_CREATE = "experience.configurations.create"
CONFIGURATIONS_UPDATE = "experience.configurations.update"
CONFIGURATIONS_DELETE = "experience.configurations.delete"
CONFIGURATIONS_MANAGE = "experience.configurations.manage"

SETTINGS_VIEW = "experience.settings.view"
SETTINGS_MANAGE = "experience.settings.manage"

AUDIT_VIEW = "experience.audit.view"

# Planned trees (registered for discovery; enforced in later phases)
SITES_VIEW = "experience.sites.view"
SITES_CREATE = "experience.sites.create"
SITES_UPDATE = "experience.sites.update"
SITES_DELETE = "experience.sites.delete"
SITES_MANAGE = "experience.sites.manage"

PAGES_VIEW = "experience.pages.view"
PAGES_CREATE = "experience.pages.create"
PAGES_UPDATE = "experience.pages.update"
PAGES_DELETE = "experience.pages.delete"
PAGES_MANAGE = "experience.pages.manage"

DOMAINS_VIEW = "experience.domains.view"
DOMAINS_CREATE = "experience.domains.create"
DOMAINS_UPDATE = "experience.domains.update"
DOMAINS_DELETE = "experience.domains.delete"
DOMAINS_MANAGE = "experience.domains.manage"

COMPONENTS_VIEW = "experience.components.view"
COMPONENTS_CREATE = "experience.components.create"
COMPONENTS_UPDATE = "experience.components.update"
COMPONENTS_DELETE = "experience.components.delete"
COMPONENTS_MANAGE = "experience.components.manage"
THEMES_VIEW = "experience.themes.view"
THEMES_CREATE = "experience.themes.create"
THEMES_UPDATE = "experience.themes.update"
THEMES_DELETE = "experience.themes.delete"
THEMES_MANAGE = "experience.themes.manage"
LAYOUTS_VIEW = "experience.layouts.view"
LAYOUTS_CREATE = "experience.layouts.create"
LAYOUTS_UPDATE = "experience.layouts.update"
LAYOUTS_DELETE = "experience.layouts.delete"
LAYOUTS_MANAGE = "experience.layouts.manage"
TEMPLATES_VIEW = "experience.templates.view"
TEMPLATES_CREATE = "experience.templates.create"
TEMPLATES_UPDATE = "experience.templates.update"
TEMPLATES_DELETE = "experience.templates.delete"
TEMPLATES_MANAGE = "experience.templates.manage"
LOCALES_VIEW = "experience.locales.view"
LOCALES_CREATE = "experience.locales.create"
LOCALES_UPDATE = "experience.locales.update"
LOCALES_DELETE = "experience.locales.delete"
LOCALES_MANAGE = "experience.locales.manage"
MEDIA_REFS_VIEW = "experience.media_refs.view"
MEDIA_REFS_CREATE = "experience.media_refs.create"
MEDIA_REFS_UPDATE = "experience.media_refs.update"
MEDIA_REFS_DELETE = "experience.media_refs.delete"
MEDIA_REFS_MANAGE = "experience.media_refs.manage"
FORMS_VIEW = "experience.forms.view"
FORMS_CREATE = "experience.forms.create"
FORMS_UPDATE = "experience.forms.update"
FORMS_DELETE = "experience.forms.delete"
FORMS_MANAGE = "experience.forms.manage"
SURVEYS_VIEW = "experience.surveys.view"
SURVEYS_CREATE = "experience.surveys.create"
SURVEYS_UPDATE = "experience.surveys.update"
SURVEYS_DELETE = "experience.surveys.delete"
SURVEYS_MANAGE = "experience.surveys.manage"
APPOINTMENTS_VIEW = "experience.appointments.view"
APPOINTMENTS_CREATE = "experience.appointments.create"
APPOINTMENTS_UPDATE = "experience.appointments.update"
APPOINTMENTS_DELETE = "experience.appointments.delete"
APPOINTMENTS_MANAGE = "experience.appointments.manage"
PUBLISHING_VIEW = "experience.publishing.view"
PUBLISHING_CREATE = "experience.publishing.create"
PUBLISHING_UPDATE = "experience.publishing.update"
PUBLISHING_DELETE = "experience.publishing.delete"
PUBLISHING_MANAGE = "experience.publishing.manage"
SEO_VIEW = "experience.seo.view"
SEO_CREATE = "experience.seo.create"
SEO_UPDATE = "experience.seo.update"
SEO_DELETE = "experience.seo.delete"
SEO_MANAGE = "experience.seo.manage"
PWA_VIEW = "experience.pwa.view"
PWA_CREATE = "experience.pwa.create"
PWA_UPDATE = "experience.pwa.update"
PWA_DELETE = "experience.pwa.delete"
PWA_MANAGE = "experience.pwa.manage"
BUNDLES_VIEW = "experience.bundles.view"
BUNDLES_CREATE = "experience.bundles.create"
BUNDLES_UPDATE = "experience.bundles.update"
BUNDLES_DELETE = "experience.bundles.delete"
BUNDLES_MANAGE = "experience.bundles.manage"
FEATURE_TOGGLES_VIEW = "experience.feature_toggles.view"
FEATURE_TOGGLES_CREATE = "experience.feature_toggles.create"
FEATURE_TOGGLES_UPDATE = "experience.feature_toggles.update"
FEATURE_TOGGLES_DELETE = "experience.feature_toggles.delete"
FEATURE_TOGGLES_MANAGE = "experience.feature_toggles.manage"
CONSUMER_CONNECTORS_VIEW = "experience.consumer_connectors.view"
CONSUMER_CONNECTORS_CREATE = "experience.consumer_connectors.create"
CONSUMER_CONNECTORS_UPDATE = "experience.consumer_connectors.update"
CONSUMER_CONNECTORS_DELETE = "experience.consumer_connectors.delete"
CONSUMER_CONNECTORS_MANAGE = "experience.consumer_connectors.manage"
WIDGETS_VIEW = "experience.widgets.view"
WIDGETS_CREATE = "experience.widgets.create"
WIDGETS_UPDATE = "experience.widgets.update"
WIDGETS_DELETE = "experience.widgets.delete"
WIDGETS_MANAGE = "experience.widgets.manage"
NOTIFY_VIEW = "experience.notify.view"
NOTIFY_CREATE = "experience.notify.create"
NOTIFY_UPDATE = "experience.notify.update"
NOTIFY_DELETE = "experience.notify.delete"
NOTIFY_MANAGE = "experience.notify.manage"

ANALYTICS_VIEW = "experience.analytics.view"
ANALYTICS_CREATE = "experience.analytics.create"
ANALYTICS_UPDATE = "experience.analytics.update"
ANALYTICS_DELETE = "experience.analytics.delete"
ANALYTICS_MANAGE = "experience.analytics.manage"

AI_HOOKS_VIEW = "experience.ai_hooks.view"
AI_HOOKS_CREATE = "experience.ai_hooks.create"
AI_HOOKS_UPDATE = "experience.ai_hooks.update"
AI_HOOKS_DELETE = "experience.ai_hooks.delete"
AI_HOOKS_MANAGE = "experience.ai_hooks.manage"

ALL_PERMISSIONS: list[str] = [
    EXPERIENCE_VIEW,
    EXPERIENCE_MANAGE,
    WORKSPACES_VIEW,
    WORKSPACES_CREATE,
    WORKSPACES_UPDATE,
    WORKSPACES_DELETE,
    WORKSPACES_MANAGE,
    LOCALE_PROFILES_VIEW,
    LOCALE_PROFILES_CREATE,
    LOCALE_PROFILES_UPDATE,
    LOCALE_PROFILES_DELETE,
    LOCALE_PROFILES_MANAGE,
    EXTERNAL_PROVIDERS_VIEW,
    EXTERNAL_PROVIDERS_CREATE,
    EXTERNAL_PROVIDERS_UPDATE,
    EXTERNAL_PROVIDERS_DELETE,
    EXTERNAL_PROVIDERS_MANAGE,
    RENDER_ENGINES_VIEW,
    RENDER_ENGINES_CREATE,
    RENDER_ENGINES_UPDATE,
    RENDER_ENGINES_DELETE,
    RENDER_ENGINES_MANAGE,
    CONFIGURATIONS_VIEW,
    CONFIGURATIONS_CREATE,
    CONFIGURATIONS_UPDATE,
    CONFIGURATIONS_DELETE,
    CONFIGURATIONS_MANAGE,
    SETTINGS_VIEW,
    SETTINGS_MANAGE,
    AUDIT_VIEW,
    SITES_VIEW,
    SITES_CREATE,
    SITES_UPDATE,
    SITES_DELETE,
    SITES_MANAGE,
    PAGES_VIEW,
    PAGES_CREATE,
    PAGES_UPDATE,
    PAGES_DELETE,
    PAGES_MANAGE,
    DOMAINS_VIEW,
    DOMAINS_CREATE,
    DOMAINS_UPDATE,
    DOMAINS_DELETE,
    DOMAINS_MANAGE,
    COMPONENTS_VIEW,
    COMPONENTS_CREATE,
    COMPONENTS_UPDATE,
    COMPONENTS_DELETE,
    COMPONENTS_MANAGE,
    THEMES_VIEW,
    THEMES_CREATE,
    THEMES_UPDATE,
    THEMES_DELETE,
    THEMES_MANAGE,
    LAYOUTS_VIEW,
    LAYOUTS_CREATE,
    LAYOUTS_UPDATE,
    LAYOUTS_DELETE,
    LAYOUTS_MANAGE,
    TEMPLATES_VIEW,
    TEMPLATES_CREATE,
    TEMPLATES_UPDATE,
    TEMPLATES_DELETE,
    TEMPLATES_MANAGE,
    LOCALES_VIEW,
    LOCALES_CREATE,
    LOCALES_UPDATE,
    LOCALES_DELETE,
    LOCALES_MANAGE,
    MEDIA_REFS_VIEW,
    MEDIA_REFS_CREATE,
    MEDIA_REFS_UPDATE,
    MEDIA_REFS_DELETE,
    MEDIA_REFS_MANAGE,
    FORMS_VIEW,
    FORMS_CREATE,
    FORMS_UPDATE,
    FORMS_DELETE,
    FORMS_MANAGE,
    SURVEYS_VIEW,
    SURVEYS_CREATE,
    SURVEYS_UPDATE,
    SURVEYS_DELETE,
    SURVEYS_MANAGE,
    APPOINTMENTS_VIEW,
    APPOINTMENTS_CREATE,
    APPOINTMENTS_UPDATE,
    APPOINTMENTS_DELETE,
    APPOINTMENTS_MANAGE,
    PUBLISHING_VIEW,
    PUBLISHING_CREATE,
    PUBLISHING_UPDATE,
    PUBLISHING_DELETE,
    PUBLISHING_MANAGE,
    SEO_VIEW,
    SEO_CREATE,
    SEO_UPDATE,
    SEO_DELETE,
    SEO_MANAGE,
    PWA_VIEW,
    PWA_CREATE,
    PWA_UPDATE,
    PWA_DELETE,
    PWA_MANAGE,
    BUNDLES_VIEW,
    BUNDLES_CREATE,
    BUNDLES_UPDATE,
    BUNDLES_DELETE,
    BUNDLES_MANAGE,
    FEATURE_TOGGLES_VIEW,
    FEATURE_TOGGLES_CREATE,
    FEATURE_TOGGLES_UPDATE,
    FEATURE_TOGGLES_DELETE,
    FEATURE_TOGGLES_MANAGE,
    CONSUMER_CONNECTORS_VIEW,
    CONSUMER_CONNECTORS_CREATE,
    CONSUMER_CONNECTORS_UPDATE,
    CONSUMER_CONNECTORS_DELETE,
    CONSUMER_CONNECTORS_MANAGE,
    WIDGETS_VIEW,
    WIDGETS_CREATE,
    WIDGETS_UPDATE,
    WIDGETS_DELETE,
    WIDGETS_MANAGE,
    NOTIFY_VIEW,
    NOTIFY_CREATE,
    NOTIFY_UPDATE,
    NOTIFY_DELETE,
    NOTIFY_MANAGE,
    ANALYTICS_VIEW,
    ANALYTICS_CREATE,
    ANALYTICS_UPDATE,
    ANALYTICS_DELETE,
    ANALYTICS_MANAGE,
    AI_HOOKS_VIEW,
    AI_HOOKS_CREATE,
    AI_HOOKS_UPDATE,
    AI_HOOKS_DELETE,
    AI_HOOKS_MANAGE,
]

PERMISSION_PREFIXES: tuple[str, ...] = (
    "experience.",
    "experience.workspaces.",
    "experience.locale_profiles.",
    "experience.external_providers.",
    "experience.render_engines.",
    "experience.configurations.",
    "experience.settings.",
    "experience.audit.",
    "experience.sites.",
    "experience.pages.",
    "experience.domains.",
    "experience.components.",
    "experience.themes.",
    "experience.layouts.",
    "experience.templates.",
    "experience.locales.",
    "experience.media_refs.",
    "experience.forms.",
    "experience.surveys.",
    "experience.appointments.",
    "experience.publishing.",
    "experience.seo.",
    "experience.pwa.",
    "experience.bundles.",
    "experience.feature_toggles.",
    "experience.consumer_connectors.",
    "experience.widgets.",
    "experience.notify.",
    "experience.analytics.",
    "experience.ai_hooks.",
)
