from fastapi import FastAPI
from app.salary_analytics.routes import analysis, reports, pipeline, load, base, train
from app.salary_analytics.middlewares.middleware import add_middlewares
from app.salary_analytics.events.lifecycle import register_events
from app.utils.logger import logger
import socket

"""
Salary Analytics Package
A package for analyzing and predicting salary patterns from transaction data.
"""

__version__ = "0.1.0" 


def create_app() -> FastAPI:
    app = FastAPI(
        title="Salary Analytics API",
        description="API for analyzing and predicting salary patterns from transaction data",
        version="1.0.0"
    )

    # Middlewares
    add_middlewares(app)

    # Events
    register_events(app)

    # Routers
    app.include_router(base.router, tags=["Base"])
    app.include_router(analysis.router, prefix="/analyze", tags=["Analysis"])
    app.include_router(reports.router, tags=["Reports"])
    app.include_router(pipeline.router, tags=["Pipeline"])
    app.include_router(load.router, tags=["Data"])
    app.include_router(train.router, tags=["Model Training"])


    return app
