"""Healthcare permission definitions — Phase 13.0 foundation."""
from __future__ import annotations

HEALTHCARE_VIEW = "healthcare.view"
HEALTHCARE_MANAGE = "healthcare.manage"

CLINICS_VIEW = "healthcare.clinics.view"
CLINICS_CREATE = "healthcare.clinics.create"
CLINICS_UPDATE = "healthcare.clinics.update"
CLINICS_DELETE = "healthcare.clinics.delete"
CLINICS_MANAGE = "healthcare.clinics.manage"

BRANCHES_VIEW = "healthcare.branches.view"
BRANCHES_CREATE = "healthcare.branches.create"
BRANCHES_UPDATE = "healthcare.branches.update"
BRANCHES_DELETE = "healthcare.branches.delete"
BRANCHES_MANAGE = "healthcare.branches.manage"

DEPARTMENTS_VIEW = "healthcare.departments.view"
DEPARTMENTS_CREATE = "healthcare.departments.create"
DEPARTMENTS_UPDATE = "healthcare.departments.update"
DEPARTMENTS_DELETE = "healthcare.departments.delete"
DEPARTMENTS_MANAGE = "healthcare.departments.manage"

DOCTORS_VIEW = "healthcare.doctors.view"
DOCTORS_CREATE = "healthcare.doctors.create"
DOCTORS_UPDATE = "healthcare.doctors.update"
DOCTORS_DELETE = "healthcare.doctors.delete"
DOCTORS_MANAGE = "healthcare.doctors.manage"

PATIENTS_VIEW = "healthcare.patients.view"
PATIENTS_CREATE = "healthcare.patients.create"
PATIENTS_UPDATE = "healthcare.patients.update"
PATIENTS_DELETE = "healthcare.patients.delete"
PATIENTS_MANAGE = "healthcare.patients.manage"

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

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

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

AUDIT_VIEW = "healthcare.audit.view"

# Planned trees (registered for discovery; enforced in later phases)
APPOINTMENTS_VIEW = "healthcare.appointments.view"
APPOINTMENTS_MANAGE = "healthcare.appointments.manage"
SCHEDULES_VIEW = "healthcare.schedules.view"
SCHEDULES_MANAGE = "healthcare.schedules.manage"
DOCTOR_PANEL_VIEW = "healthcare.doctor_panel.view"
VISIT_SESSIONS_MANAGE = "healthcare.visit_sessions.manage"
VISIT_NOTES_MANAGE = "healthcare.visit_notes.manage"
CLINIC_ADMIN_VIEW = "healthcare.clinic_admin.view"
CLINIC_ADMIN_MANAGE = "healthcare.clinic_admin.manage"
CLINIC_SERVICES_VIEW = "healthcare.clinic_services.view"
CLINIC_SERVICES_MANAGE = "healthcare.clinic_services.manage"
PATIENT_PORTAL_VIEW = "healthcare.patient_portal.view"
PATIENT_PORTAL_MANAGE = "healthcare.patient_portal.manage"
MEDICAL_RECORDS_VIEW = "healthcare.medical_records.view"
MEDICAL_RECORDS_MANAGE = "healthcare.medical_records.manage"
ENCOUNTERS_MANAGE = "healthcare.encounters.manage"
PRESCRIPTIONS_SUBMIT = "healthcare.prescriptions.submit"
PHARMACIES_MANAGE = "healthcare.pharmacies.manage"
PRESCRIPTION_ORDERS_FULFILL = "healthcare.prescription_orders.fulfill"
DELIVERY_INTEGRATION_VIEW = "healthcare.delivery_integration.view"
DELIVERY_INTEGRATION_MANAGE = "healthcare.delivery_integration.manage"
DELIVERY_INTEGRATION_SUBMIT = "healthcare.delivery_integration.submit"
VISITS_VIEW = "healthcare.visits.view"
VISITS_MANAGE = "healthcare.visits.manage"
PHARMACY_VIEW = "healthcare.pharmacy.view"
PHARMACY_MANAGE = "healthcare.pharmacy.manage"
RECORDS_VIEW = "healthcare.records.view"
RECORDS_MANAGE = "healthcare.records.manage"

ALL_PERMISSIONS: list[str] = [
    HEALTHCARE_VIEW,
    HEALTHCARE_MANAGE,
    CLINICS_VIEW,
    CLINICS_CREATE,
    CLINICS_UPDATE,
    CLINICS_DELETE,
    CLINICS_MANAGE,
    BRANCHES_VIEW,
    BRANCHES_CREATE,
    BRANCHES_UPDATE,
    BRANCHES_DELETE,
    BRANCHES_MANAGE,
    DEPARTMENTS_VIEW,
    DEPARTMENTS_CREATE,
    DEPARTMENTS_UPDATE,
    DEPARTMENTS_DELETE,
    DEPARTMENTS_MANAGE,
    DOCTORS_VIEW,
    DOCTORS_CREATE,
    DOCTORS_UPDATE,
    DOCTORS_DELETE,
    DOCTORS_MANAGE,
    PATIENTS_VIEW,
    PATIENTS_CREATE,
    PATIENTS_UPDATE,
    PATIENTS_DELETE,
    PATIENTS_MANAGE,
    EXTERNAL_PROVIDERS_VIEW,
    EXTERNAL_PROVIDERS_CREATE,
    EXTERNAL_PROVIDERS_UPDATE,
    EXTERNAL_PROVIDERS_DELETE,
    EXTERNAL_PROVIDERS_MANAGE,
    CONFIGURATIONS_VIEW,
    CONFIGURATIONS_CREATE,
    CONFIGURATIONS_UPDATE,
    CONFIGURATIONS_DELETE,
    CONFIGURATIONS_MANAGE,
    SETTINGS_VIEW,
    SETTINGS_MANAGE,
    AUDIT_VIEW,
    APPOINTMENTS_VIEW,
    APPOINTMENTS_MANAGE,
    SCHEDULES_VIEW,
    SCHEDULES_MANAGE,
    DOCTOR_PANEL_VIEW,
    VISIT_SESSIONS_MANAGE,
    VISIT_NOTES_MANAGE,
    CLINIC_ADMIN_VIEW,
    CLINIC_ADMIN_MANAGE,
    CLINIC_SERVICES_VIEW,
    CLINIC_SERVICES_MANAGE,
    PATIENT_PORTAL_VIEW,
    PATIENT_PORTAL_MANAGE,
    MEDICAL_RECORDS_VIEW,
    MEDICAL_RECORDS_MANAGE,
    ENCOUNTERS_MANAGE,
    PRESCRIPTIONS_SUBMIT,
    PHARMACIES_MANAGE,
    PRESCRIPTION_ORDERS_FULFILL,
    DELIVERY_INTEGRATION_VIEW,
    DELIVERY_INTEGRATION_MANAGE,
    DELIVERY_INTEGRATION_SUBMIT,
    VISITS_VIEW,
    VISITS_MANAGE,
    PHARMACY_VIEW,
    PHARMACY_MANAGE,
    RECORDS_VIEW,
    RECORDS_MANAGE,
]

PERMISSION_PREFIXES: tuple[str, ...] = (
    "healthcare.",
    "healthcare.clinics.",
    "healthcare.branches.",
    "healthcare.departments.",
    "healthcare.doctors.",
    "healthcare.patients.",
    "healthcare.external_providers.",
    "healthcare.configurations.",
    "healthcare.settings.",
    "healthcare.audit.",
    "healthcare.appointments.",
    "healthcare.schedules.",
    "healthcare.doctor_panel.",
    "healthcare.visit_sessions.",
    "healthcare.visit_notes.",
    "healthcare.clinic_admin.",
    "healthcare.clinic_services.",
    "healthcare.patient_portal.",
    "healthcare.medical_records.",
    "healthcare.encounters.",
    "healthcare.prescriptions.",
    "healthcare.pharmacies.",
    "healthcare.prescription_orders.",
    "healthcare.delivery_integration.",
    "healthcare.visits.",
    "healthcare.pharmacy.",
    "healthcare.records.",
)
