from datetime import datetime from typing import Optional, Dict, Any from pydantic import BaseModel, ConfigDict, Field class NotificationChannelCreate(BaseModel): name: str = Field(..., min_length=1, max_length=100) channel_type: str = Field(..., pattern=r"^(dingtalk|webhook_feishu|email)$") config: Dict[str, Any] is_enabled: bool = True class NotificationChannelUpdate(BaseModel): name: Optional[str] = Field(default=None, min_length=1, max_length=100) channel_type: Optional[str] = Field(default=None, pattern=r"^(dingtalk|webhook_feishu|email)$") config: Optional[Dict[str, Any]] = None is_enabled: Optional[bool] = None class NotificationChannelResponse(BaseModel): id: int name: str channel_type: str config: Dict[str, Any] # passwords masked in endpoint is_enabled: bool created_at: datetime updated_at: datetime model_config = ConfigDict(from_attributes=True)