from sqlmodel import SQLModel, Field, Relationship
from typing import Optional, TYPE_CHECKING
if TYPE_CHECKING:
    from app.models.user import User
from uuid import UUID, uuid4
from datetime import datetime
from sqlalchemy import Column, DateTime, func
from enum import Enum

class ReportStatus(str, Enum):
    PENDING = "pending"
    RESOLVED = "resolved"
    ARCHIVED = "archived"

class Report(SQLModel, table=True):
    __tablename__ = "reports"

    id: Optional[UUID] = Field(default_factory=uuid4, primary_key=True)
    user_id: Optional[UUID] = Field(default=None, foreign_key="users.id")
    message: str
    status: ReportStatus = Field(default=ReportStatus.PENDING)
    created_at: Optional[datetime] = Field(
        sa_column=Column(DateTime, server_default=func.now())
    )

    # Relationships
    user: Optional["User"] = Relationship()
