using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;

namespace Entities.Contracts
{
	[Table("classes")]
	public class Class
	{
		[Key]
		[Column("class_id")]
		public int ClassId { get; set; }

		[Column("grade_id")]
		public int GradeId { get; set; }
		public Grade Grade { get; set; }

		[Column("class_name")]
		[MaxLength(30)]
		public string ClassName { get; set; }

		[Column("head_teacher_id")]
		public int? HeadTeacherId { get; set; }
		public User HeadTeacher { 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; }

		// Navigation Properties
		public ICollection<ClassTeacher> ClassTeachers { get; set; }
		public ICollection<ClassStudent> ClassStudents { get; set; }
		public ICollection<AssignmentClass> AssignmentClasses { get; set; }

		public Class()
		{
			ClassStudents = new HashSet<ClassStudent>();
			ClassTeachers = new HashSet<ClassTeacher>();
			AssignmentClasses = new HashSet<AssignmentClass>();
			CreatedAt = DateTime.Now;
			UpdatedAt = DateTime.Now;
		}
	}
}
