from cpm_assessment import db
from datetime import datetime

class BlankAnswer(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    assessment_assignment_id = db.Column(db.Integer, db.ForeignKey('assessment_assignment.id'), nullable=False)
    question_id = db.Column(db.Integer, db.ForeignKey('question.id'), nullable=False)
    text_answer = db.Column(db.Text, nullable=True)
    audio_url = db.Column(db.String(255), nullable=True)
    transcript = db.Column(db.Text, nullable=True)
    created_at = db.Column(db.DateTime, default=datetime.utcnow, nullable=False)

    assignment = db.relationship('AssessmentAssignment', backref=db.backref('blank_answers', cascade='all, delete-orphan'))
    question = db.relationship('Question')
