from pydantic import BaseModel from datetime import datetime from typing import Optional class PostBase(BaseModel): title: str content: str image_url: Optional[str] = None is_announcement: bool = False is_prayer_request: bool = False class PostCreate(PostBase): pass class PostUpdate(BaseModel): title: Optional[str] = None content: Optional[str] = None image_url: Optional[str] = None is_announcement: Optional[bool] = None is_prayer_request: Optional[bool] = None class PostResponse(PostBase): id: int author_id: int created_at: datetime updated_at: datetime author_name: Optional[str] = None likes_count: int = 0 comments_count: int = 0 class Config: from_attributes = True class CommentBase(BaseModel): content: str class CommentCreate(CommentBase): pass class CommentResponse(CommentBase): id: int post_id: int author_id: int author_name: Optional[str] = None created_at: datetime updated_at: datetime class Config: from_attributes = True