from pydantic import BaseModel
from datetime import datetime
from typing import Optional


class JournalEntryResponse(BaseModel):
    """Read-only schema for journal entries"""
    id: int
    entity_type: str  # PPR, LOCAL_FLIGHT, ARRIVAL, DEPARTURE
    entity_id: int
    entry: str
    user: str
    ip: Optional[str]
    entry_dt: datetime

    class Config:
        from_attributes = True


class EntityJournalResponse(BaseModel):
    """Response containing all journal entries for an entity"""
    entity_type: str
    entity_id: int
    entries: list[JournalEntryResponse]
    total_entries: int

    class Config:
        from_attributes = True
