using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace LSFE.Infrastructure.Entities.Auth { [Table("Modules")] public class Module { [Key] public int ModuleId { get; set; } [Required] [MaxLength(50)] public required string ModuleName { get; set; } [Required] [MaxLength(50)] public required string ModuleKey { get; set; } [Required] [MaxLength(50)] public required string IconName { get; set; } public int DisplayOrder { get; set; } public bool IsActive { get; set; } = true; // CHANGE: Make this nullable for root modules public int? ParentModuleId { get; set; } [MaxLength(200)] public required string RouteURL { get; set; } [MaxLength(200)] public string? Description { get; set; } public DateTime CreatedDate { get; set; } = DateTime.UtcNow; public DateTime UpdatedAt { get; set; } = DateTime.UtcNow; [ForeignKey("ParentModuleId")] public virtual Module? ParentModule { get; set; } public virtual ICollection? ChildModules { get; set; } public virtual ICollection? RoleModulePermissions { get; set; } } }