"""Add teacher_feedback table for Phase 7.

Revision ID: 006_teacher_feedback
Revises: 005_lesson_reflections
Create Date: 2026-01-15 19:00:00.000000
"""
from alembic import op
import sqlalchemy as sa

# revision identifiers
revision = '006_teacher_feedback'
down_revision = '005_lesson_reflections'
branch_labels = None
depends_on = None


def upgrade() -> None:
    """Create teacher_feedback table."""
    op.create_table(
        'teacher_feedback',
        sa.Column('id', sa.String(36), primary_key=True),
        sa.Column('teacher_id', sa.String(100), nullable=False, index=True),
        sa.Column('teacher_name', sa.String(200), default=''),
        sa.Column('teacher_email', sa.String(200), default=''),
        sa.Column('title', sa.String(500), nullable=False),
        sa.Column('description', sa.Text, nullable=False),
        sa.Column('feedback_type', sa.String(50), nullable=False, default='improvement'),
        sa.Column('priority', sa.String(50), nullable=False, default='medium'),
        sa.Column('status', sa.String(50), nullable=False, default='new', index=True),
        sa.Column('related_feature', sa.String(50), nullable=True),
        sa.Column('context_url', sa.String(500), default=''),
        sa.Column('context_phase', sa.String(50), default=''),
        sa.Column('context_session_id', sa.String(36), nullable=True),
        sa.Column('user_agent', sa.String(500), default=''),
        sa.Column('response', sa.Text, default=''),
        sa.Column('responded_at', sa.DateTime, nullable=True),
        sa.Column('responded_by', sa.String(100), nullable=True),
        sa.Column('created_at', sa.DateTime, default=sa.func.now()),
        sa.Column('updated_at', sa.DateTime, default=sa.func.now(), onupdate=sa.func.now()),
    )


def downgrade() -> None:
    """Drop teacher_feedback table."""
    op.drop_table('teacher_feedback')
