from fastapi import FastAPI
from app.api.router import router

import logging
from app.logging_config import setup_logging

# 加载日志配置
setup_logging()

# 获取日志记录器
logger = logging.getLogger(__name__)

app = FastAPI(
    title="Daily Report API",
    description="三工单日报、简报的api",
    version="1.0.0",
)

# 代理前端静态文件html等
from fastapi.staticfiles import StaticFiles

app.mount("/sgd/file", StaticFiles(directory="temp_downloads"), name="temp_downloads")
app.mount(
    "/sgd/file", StaticFiles(directory="temp_downloads"), name="temp_download_raw"
)

# 使用路由
app.include_router(router)


if __name__ == "__main__":
    import uvicorn

    uvicorn.run(app, host="0.0.0.0", port=8000)
