using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TMSDAL.DTO.AttemptResponse
{
///
/// Maps to DBO.TATTEMPTRESPONSE
/// Per-question response within one assessment attempt.
/// Detail of TASSESSMENTATTEMPT — one row per question answered.
/// ASSESSMENTQUESTIONID and QUESTIONBANKID are mutually exclusive:
/// Simple mode → ASSESSMENTQUESTIONID > 0, QUESTIONBANKID = -1
/// Structured → QUESTIONBANKID > 0, ASSESSMENTQUESTIONID = -1
/// ISCORRECT: -1 = Pending, 0 = Wrong, 1 = Correct
///
public class AttemptResponseDTO
{
// =====================================================
// PRIMARY KEY
// =====================================================
public int AttemptResponseId { get; set; }
// =====================================================
// PARENT FK
// =====================================================
/// FK → TASSESSMENTATTEMPT.ASSESSMENTATTEMPTID
public int AssessmentAttemptId { get; set; }
// =====================================================
// FOREIGN KEYS + JOINED DISPLAY FIELDS
// =====================================================
///
/// FK → MASSESSMENTQUESTION.ASSESSMENTQUESTIONID
/// -1 when QuestionBankId is used (Structured mode).
///
public int AssessmentQuestionId { get; set; } = -1;
///
/// FK → MQUESTIONBANK.QUESTIONBANKID
/// -1 when AssessmentQuestionId is used (Simple mode).
///
public int QuestionBankId { get; set; } = -1;
///
/// Joined — COALESCE(MASSESSMENTQUESTION.QUESTIONTEXT, MQUESTIONBANK.QUESTIONTEXT)
/// Display reference only — shows question text regardless of mode.
///
public string? QuestionText { get; set; }
///
/// Joined — MQUESTIONBANK.QUESTIONTITLE
/// Short title of the question for list display. Null in Simple mode
/// (MASSESSMENTQUESTION has no title column, only QuestionText).
///
public string? QuestionTitle { get; set; }
// =====================================================
// BUSINESS COLUMNS
// =====================================================
///
/// Answer submitted by the employee.
/// MCQ/TrueFalse = option key e.g. "A" / "True".
/// ShortAnswer/Essay = free text.
/// Matching = JSON pairs e.g. [{"left":"A","right":"1"}].
/// Null = question skipped.
///
public string? ResponseGiven { get; set; }
///
/// -1 = Pending manual evaluation.
/// 0 = Wrong.
/// 1 = Correct.
/// SMALLINT to accommodate -1 sentinel.
///
public short IsCorrect { get; set; } = -1;
///
/// Numeric(9,4) — marks awarded for this response.
/// 0 for wrong/pending. Full marks for correct.
/// Partial marks allowed for manual types.
///
public decimal MarksAwarded { get; set; } = 0;
///
/// Optional evaluator notes for this specific response.
/// Used for Observation/Practical/Assignment types.
/// Max 1000 characters.
///
public string? EvaluatorNotes { get; set; }
}
}