"""Add status Enum to Quiz

Revision ID: 90f676653400
Revises: b621ddade066
Create Date: 2026-03-04 23:50:07.083069

"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql

# revision identifiers, used by Alembic.
revision = '90f676653400'
down_revision = 'b621ddade066'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('questions', schema=None) as batch_op:
        batch_op.drop_column('image_path')
        batch_op.drop_column('explanation')

    with op.batch_alter_table('quizzes', schema=None) as batch_op:
        batch_op.add_column(sa.Column('status', sa.Enum('DRAFT', 'PUBLISHED', 'UNPUBLISHED', name='quizstatus'), nullable=False))
        batch_op.drop_column('allow_responses')
        batch_op.drop_column('shuffle_questions')
        batch_op.drop_column('end_date')
        batch_op.drop_column('start_date')
        batch_op.drop_column('grading_category')

    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('quizzes', schema=None) as batch_op:
        batch_op.add_column(sa.Column('grading_category', mysql.VARCHAR(length=100), nullable=True))
        batch_op.add_column(sa.Column('start_date', mysql.DATETIME(), nullable=True))
        batch_op.add_column(sa.Column('end_date', mysql.DATETIME(), nullable=True))
        batch_op.add_column(sa.Column('shuffle_questions', mysql.TINYINT(display_width=1), autoincrement=False, nullable=False))
        batch_op.add_column(sa.Column('allow_responses', mysql.TINYINT(display_width=1), autoincrement=False, nullable=False))
        batch_op.drop_column('status')

    with op.batch_alter_table('questions', schema=None) as batch_op:
        batch_op.add_column(sa.Column('explanation', mysql.TEXT(), nullable=True))
        batch_op.add_column(sa.Column('image_path', mysql.VARCHAR(length=500), nullable=True))

    # ### end Alembic commands ###
