from fastapi import APIRouter, Query
from typing import Any, List, Dict
from app.services.tjnetwork import get_scheme_schema, get_scheme, get_all_schemes

router = APIRouter()

@router.get("/getschemeschema/", summary="获取方案模式", description="获取指定网络的方案模式定义")
async def fastapi_get_scheme_schema(network: str = Query(..., description="管网名称（或数据库名称）")) -> dict[str, dict[Any, Any]]:
    """
    获取方案模式定义
    
    返回指定网络的方案模式结构定义
    """
    return get_scheme_schema(network)

@router.get("/getscheme/", summary="获取单个方案", description="根据名称获取指定的方案信息")
async def fastapi_get_scheme(network: str = Query(..., description="管网名称（或数据库名称）"), schema_name: str = Query(..., description="方案名称")) -> dict[Any, Any]:
    """
    获取单个方案详情
    
    返回指定网络中指定名称的方案详细信息
    """
    return get_scheme(network, schema_name)

@router.get("/getallschemes/", summary="获取所有方案", description="获取指定网络的所有方案信息")
async def fastapi_get_all_schemes(network: str = Query(..., description="管网名称（或数据库名称）")) -> list[dict[Any, Any]]:
    """
    获取所有方案列表
    
    返回指定网络中所有可用的方案
    """
    return get_all_schemes(network)
