from fastapi import APIRouter, Depends, HTTPException
from sqlalchemy.orm import Session
from app.db.database import get_db
from app.models.file import File as FileModel
from app.schemas.file import FileCreate, FileUpdate, FileDelete, FileList, FileInDB
from app.routes.set_label_routes import router as set_label_router
from app.routes.order_routes import router as order_router
from app.routes.manabox_routes import router as manabox_router
from app.routes.inventory_management_routes import router as inventory_management_router
router = APIRouter(prefix="/api")

# Include set label routes
router.include_router(set_label_router)

# Include order routes
router.include_router(order_router)

# Include manabox routes
router.include_router(manabox_router)

# Include inventory management routes
router.include_router(inventory_management_router)

# ============================================================================
# Health Check & Root Endpoints
# ============================================================================
@router.get("/")
async def root():
    return {"message": "CCR Cards Management API is running."}

@router.get("/health")
async def health():
    return {"status": "ok"}

# ============================================================================
# File Management Endpoints
# ============================================================================
@router.get("/files", response_model=FileList)
async def get_files(page: int = 1, limit: int = 10, type: str = None, id: int = None):
    return {"files": [], "total": 0, "page": page, "limit": limit}

@router.post("/files", response_model=FileInDB)
async def create_file(file: FileCreate):
    return {"message": "File created successfully"}

@router.put("/files/{file_id}", response_model=FileInDB)
async def update_file(file_id: int, file: FileUpdate):
    return {"message": "File updated successfully"}

@router.delete("/files/{file_id}", response_model=FileDelete)
async def delete_file(file_id: int):
    return {"message": "File deleted successfully"}