"""
Configuration-related Pydantic schemas
"""
from typing import Dict, Optional, Any
from pydantic import BaseModel, Field

class DatabaseConfig(BaseModel):
    url: str = Field(..., description="数据库连接URL")

class NewApiConfig(BaseModel):
    api_key: str = Field(..., description="New API Key")
    base_url: Optional[str] = None

class DataSourceConfig(BaseModel):
    api_key: str = Field(..., description="数据源API Key")

class ConfigResponse(BaseModel):
    database: DatabaseConfig
    new_api: NewApiConfig
    data_sources: Dict[str, DataSourceConfig]

class ConfigUpdateRequest(BaseModel):
    database: Optional[DatabaseConfig] = None
    new_api: Optional[NewApiConfig] = None
    data_sources: Optional[Dict[str, DataSourceConfig]] = None

class ConfigTestRequest(BaseModel):
    config_type: str
    config_data: Dict[str, Any]

class ConfigTestResponse(BaseModel):
    success: bool
    message: str
