using Microsoft.AspNetCore.Identity;
using System.ComponentModel.DataAnnotations.Schema;

namespace Entities.Contracts
{
	public enum UserRoles 
	{
		Student,
		Teacher,
		Administrator
	}

	public class User : IdentityUser<Guid>
	{
		public string? RefreshToken { get; set; }
		public DateTime? RefreshTokenExpiryTime { get; set; }
		public string? Address { get; set; }	
		public string? DisplayName { get; set; }
		public SubjectAreaEnum SubjectArea { get; set; } = SubjectAreaEnum.Unknown;

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

		[InverseProperty(nameof(ClassTeacher.Teacher))]
		public ICollection<ClassTeacher> TaughtClassesLink { get; set; }
		[InverseProperty(nameof(ClassStudent.Student))]
		public ICollection<ClassStudent> EnrolledClassesLink { get; set; }

		public ICollection<Question> CreatedQuestions { get; set; }
		public ICollection<Assignment> CreatedAssignments { get; set; }

		public ICollection<SubmissionDetail> SubmissionDetails { get; set; }
		public ICollection<Submission> SubmissionsAsStudent { get; set; }
		public ICollection<Submission> GradedSubmissions { get; set; }

		public User()
		{
			Id = Guid.NewGuid();
			SecurityStamp = Guid.NewGuid().ToString();

			CreatedQuestions = new HashSet<Question>();
			TaughtClassesLink = new HashSet<ClassTeacher>();
			EnrolledClassesLink = new HashSet<ClassStudent>();
			CreatedAssignments = new HashSet<Assignment>();
			GradedSubmissions = new HashSet<Submission>();
			SubmissionsAsStudent = new HashSet<Submission>();
		}
	}
}
