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("questions")]
	public class Question
	{
		[Key]
		[Column("id")]
		public Guid Id { get; set; }

		[Required]
		[Column("title")]
		[MaxLength(65535)]
		public string Title { get; set; }

		[Column("answer")]
		[MaxLength(65535)]
		public string? Answer { get; set; }

		[Required]
		[Column("type")]
		public Guid QuestioTypeId { get; set; }
		[ForeignKey(nameof(QuestioTypeId))]
		public virtual QuestionType QuestionType { get; set; }

		[Column("subject_area")]
		public Guid SubjectId { get; set; }
		[ForeignKey(nameof(SubjectId))]
		public virtual Subject Subject { get; set; }

		[Column("key_point")]
		public Guid? KeyPointId { get; set; }
		[ForeignKey(nameof(KeyPointId))]
		public virtual KeyPoint? KeyPoint { get; set; }

		[Column("lesson")]
		public Guid? LessonId { get; set; }
		[ForeignKey(nameof(LessonId))]
		public virtual Lesson? Lesson { get; set; }

		//[Required]
		//[Column("created_by")]
		//public Guid CreatorId { get; set; }
		//[ForeignKey(nameof(CreatorId))]
		//public virtual User Creator { get; set; }

		//[Column("difficulty_level")]
		//public DifficultyLevel DifficultyLevel { get; set; } = DifficultyLevel.easy;

		[Column("options")]
		public string? Options { 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; }

		[InverseProperty(nameof(ExamQuestion.Question))]
		public virtual ICollection<ExamQuestion>? ExamQuestions { get; set; }

		public Question()
		{
			Id = Guid.NewGuid();
			ExamQuestions = new HashSet<ExamQuestion>();
		}
	}


}
