"""Pydantic schemas for Comment model""" from datetime import datetime from typing import Any, Dict, Optional from pydantic import BaseModel, ConfigDict, Field class CommentCreateRequest(BaseModel): """Schema for creating a new comment""" model_config = ConfigDict( json_schema_extra={ "example": { "text": "This is a comment", } } ) text: str = Field(..., min_length=1, description="Comment text") class CommentResponse(BaseModel): """Schema for comment response""" model_config = ConfigDict( from_attributes=True, json_schema_extra={ "example": { "id": 1, "text": "This is a comment", "card_id": 1, "user_id": 1, "created_at": "2024-01-15T10:30:00", "updated_at": "2024-01-15T10:30:00", } }, ) id: int text: str card_id: int user_id: int created_at: Optional[datetime] = None updated_at: Optional[datetime] = None class CommentWithUserResponse(BaseModel): """Schema for comment response with user information""" model_config = ConfigDict( from_attributes=True, json_schema_extra={ "example": { "id": 1, "text": "This is a comment", "card_id": 1, "user_id": 1, "created_at": "2024-01-15T10:30:00", "updated_at": "2024-01-15T10:30:00", "user": { "id": 1, "email": "user@example.com", "username": "johndoe", }, } }, ) id: int text: str card_id: int user_id: int created_at: Optional[datetime] = None updated_at: Optional[datetime] = None user: Optional[Dict[str, Any]] = None