"""
Note schema definitions for common operations.
"""

from datetime import datetime
from typing import Optional
from pydantic import Field, ConfigDict
from src.apps.base.schemas.common import BaseSchema
from src.apps.users.schemas.user_common import UserResponseSchema


class NoteBase(BaseSchema):
    """Base note schema with common fields."""
    
    description: str = Field(..., description="Note content/description")


class NoteResponseSchema(NoteBase):
    """Note response schema."""
    
    model_config = ConfigDict(from_attributes=True)
    
    id: int = Field(..., description="Note's unique identifier")
    created_at: datetime = Field(..., description="When the note was created")
    updated_at: Optional[datetime] = Field(None, description="When the note was last updated")
    deleted_at: Optional[datetime] = Field(None, description="When the note was soft deleted")
    created_by_id: int = Field(..., description="ID of the user who created the note")
    created_by: UserResponseSchema = Field(..., description="User who created the note")


class NoteCreateSchema(NoteBase):
    """Schema for creating a new note."""
    
    pass  


class NoteUpdateSchema(NoteBase):
    """Schema for updating note information."""
    
    description: Optional[str] = Field(None, description="Note content/description")


class NoteListResponseSchema(BaseSchema):
    """Schema for notes list response."""
    
    model_config = ConfigDict(from_attributes=True)
    
    data: list[NoteResponseSchema] = Field(..., description="List of notes")
    success: bool = Field(True, description="Success status")
    message: str = Field(..., description="Response message")
    status_code: int = Field(200, description="HTTP status code")