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;
using Microsoft.EntityFrameworkCore;

namespace Entities.Contracts
{
	/// <summary>
	/// 班级用户关联实体类
	/// 表示用户与班级之间的多对多关系
	/// </summary>
	[Table("class_user")]
    [PrimaryKey(nameof(ClassId), nameof(UserId))]
    public class ClassUser
    {
        /// <summary>
        /// 班级ID，复合主键的一部分，外键
        /// 关联到Class表中的班级
        /// </summary>
        [Key]
        [Column("class_id", Order = 0)]
        public Guid ClassId { get; set; }
        [ForeignKey(nameof(ClassId))]
		public virtual Class Class { get; set; }
		/// <summary>
		/// 用户ID，复合主键的一部分，外键
		/// 关联到User表中的用户用户
		/// </summary>
		[Key]
        [Column("student_id", Order = 1)]
        public Guid UserId { get; set; }
		[ForeignKey(nameof(UserId))]
		public virtual User User { get; set; }

		/// <summary>
		/// 入学日期
		/// 记录用户加入该班级的日期
		/// </summary>
		[Column("enrollment_date")]
        public DateTime EnrollmentDate { get; set; }

        /// <summary>
        /// 是否已删除
        /// 软删除标记，true表示已删除
        /// </summary>
        [Column("deleted")]
        public bool IsDeleted { get; set; }



    }
}
