using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Entities.Contracts
{
	[Table("submission_details")]
	public class SubmissionDetail
	{
		[Key]
		[Column("id")]
		public Guid Id { get; set; }

		[Required]
		[Column("submission_id")]
		[ForeignKey("Submission")]
		public Guid SubmissionId { get; set; }
		[ForeignKey(nameof(SubmissionId))]
		public virtual Submission Submission { get; set; }

		[Required]
		[Column("student_id")]
		public Guid StudentId { get; set; }
		[ForeignKey(nameof(StudentId))]
		public virtual User Student { get; set; }

		[Required]
		[Column("exam_question_id")]
		public Guid ExamQuestionId { get; set; }
		[ForeignKey(nameof(ExamQuestionId))]
		public virtual ExamQuestion ExamQuestion { get; set; }

		[Column("student_answer")]
		public string? StudentAnswer { get; set; }

		[Column("is_correct")]
		public bool? IsCorrect { get; set; }

		[Column("points_awarded")]
		public float? PointsAwarded { get; set; } // 得分

		[Column("teacher_feedback")]
		public string? TeacherFeedback { get; set; }

		[Column("created_at")]
		public DateTime CreatedAt { get; set; }

		[Column("updated_at")]
		public DateTime UpdatedAt { get; set; }

		[Column("deleted")]
		public bool IsDeleted { get; set; }


		public SubmissionDetail()
		{
			Id = Guid.NewGuid();
		}
	}
}
