from fastapi import FastAPI

from src.config.settings import get_settings
from src.routes.extract import router as extract_router


def create_app() -> FastAPI:
    settings = get_settings()
    app = FastAPI(
        title="SILAL Inventory Extraction Service",
        description="Document extraction service for inbound invoice and movement-out files.",
        version="0.1.0",
    )
    app.include_router(extract_router)
    return app


app = create_app()


def run() -> None:
    import uvicorn

    settings = get_settings()
    uvicorn.run(
        "src.main:app",
        host=settings.host,
        port=settings.port,
        reload=False,
    )


if __name__ == "__main__":
    run()
