# app/modules/prospecting/schemas/interaction.py
"""Pydantic schemas for prospect interactions."""

from datetime import date, datetime

from pydantic import BaseModel, Field


class InteractionCreate(BaseModel):
    """Schema for creating an interaction."""

    interaction_type: str = Field(
        ..., pattern="^(note|call|email_sent|email_received|meeting|visit|sms|proposal_sent)$"
    )
    subject: str | None = Field(None, max_length=255)
    notes: str | None = None
    outcome: str | None = Field(None, pattern="^(positive|neutral|negative|no_answer)$")
    next_action: str | None = Field(None, max_length=255)
    next_action_date: date | None = None


class InteractionResponse(BaseModel):
    """Schema for interaction response."""

    id: int
    prospect_id: int
    interaction_type: str
    subject: str | None = None
    notes: str | None = None
    outcome: str | None = None
    next_action: str | None = None
    next_action_date: date | None = None
    created_by_user_id: int
    created_at: datetime

    class Config:
        from_attributes = True


class InteractionListResponse(BaseModel):
    """List of interactions."""

    items: list[InteractionResponse]
    total: int
