"""Phase 6.3 — Enterprise Sales Collaboration Platform schema."""
from alembic import op
from app.core.database import Base
import app.models  # noqa: F401

revision = "0004_phase_63_collaboration"
down_revision = "0003_phase_62_sales_engine"
branch_labels = None
depends_on = None


def upgrade():
    bind = op.get_bind()
    Base.metadata.create_all(bind=bind)


def downgrade():
    tables = [
        "sales_collaboration_audit",
        "crm_notifications_preferences",
        "team_assignments",
        "sales_team_members",
        "team_roles",
        "favorites",
        "bookmarks",
        "mentions",
        "comment_versions",
        "comments",
        "timeline_events",
        "sales_timeline",
        "emails",
        "email_threads",
        "call_logs",
        "call_outcomes",
        "meeting_attendees",
        "meetings",
        "task_checklists",
        "tasks",
        "activity_reminders",
        "activity_participants",
        "activity_priorities",
        "activity_statuses",
        "activity_types",
    ]
    for table in tables:
        op.drop_table(table)
