from ninja import Router
from ninja.security import SessionAuth

from envipath import settings as s
from .auth import BearerTokenAuth
from .endpoints import (
    packages,
    scenarios,
    compounds,
    rules,
    reactions,
    pathways,
    models,
    structure,
    additional_information,
    settings,
    groups,
    joblogs,
)

# Main router with authentication
router = Router(
    auth=[
        SessionAuth(),
        BearerTokenAuth(),
    ]
)

# Include all endpoint routers
router.add_router("", packages.router)
router.add_router("", scenarios.router)
router.add_router("", compounds.router)
router.add_router("", rules.router)
router.add_router("", reactions.router)
router.add_router("", pathways.router)
router.add_router("", models.router)
router.add_router("", structure.router)
router.add_router("", additional_information.router)
router.add_router("", settings.router)
router.add_router("", groups.router)
router.add_router("", joblogs.router)

if s.IUCLID_EXPORT_ENABLED:
    from epiuclid.api import router as iuclid_router

    router.add_router("", iuclid_router)
