# app/modules/prospecting/models/interaction.py """ Interaction tracking for prospect follow-ups. Logs all touchpoints: calls, emails, meetings, visits, notes. """ import enum from sqlalchemy import Column, Date, Enum, ForeignKey, Integer, String, Text from sqlalchemy.orm import relationship from app.core.database import Base from models.database.base import TimestampMixin class InteractionType(str, enum.Enum): NOTE = "note" CALL = "call" EMAIL_SENT = "email_sent" EMAIL_RECEIVED = "email_received" MEETING = "meeting" VISIT = "visit" SMS = "sms" PROPOSAL_SENT = "proposal_sent" class InteractionOutcome(str, enum.Enum): POSITIVE = "positive" NEUTRAL = "neutral" NEGATIVE = "negative" NO_ANSWER = "no_answer" class ProspectInteraction(Base, TimestampMixin): """A logged interaction with a prospect.""" __tablename__ = "prospect_interactions" id = Column(Integer, primary_key=True, index=True) prospect_id = Column(Integer, ForeignKey("prospects.id", ondelete="CASCADE"), nullable=False, index=True) interaction_type = Column(Enum(InteractionType), nullable=False) subject = Column(String(255), nullable=True) notes = Column(Text, nullable=True) outcome = Column(Enum(InteractionOutcome), nullable=True) next_action = Column(String(255), nullable=True) next_action_date = Column(Date, nullable=True) created_by_user_id = Column(Integer, nullable=False) # Relationships prospect = relationship("Prospect", back_populates="interactions")