--
-- Host: localhost    Database: TahfeezDb
-- ------------------------------------------------------


--
-- Table structure for table `AspNetRoleClaims`
--

CREATE TABLE `AspNetRoleClaims` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `RoleId` char(36) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL,
  `ClaimType` longtext DEFAULT NULL,
  `ClaimValue` longtext DEFAULT NULL,
  PRIMARY KEY (`Id`),
  KEY `IX_AspNetRoleClaims_RoleId` (`RoleId`),
  CONSTRAINT `FK_AspNetRoleClaims_AspNetRoles_RoleId` FOREIGN KEY (`RoleId`) REFERENCES `AspNetRoles` (`Id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

--
-- Dumping data for table `AspNetRoleClaims`
--

COMMIT;

--
-- Table structure for table `AspNetRoles`
--

CREATE TABLE `AspNetRoles` (
  `Id` char(36) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL,
  `CreatedAt` datetime(6) NOT NULL,
  `UpdatedAt` datetime(6) DEFAULT NULL,
  `DeletedAt` datetime(6) DEFAULT NULL,
  `CreatedBy` longtext DEFAULT NULL,
  `UpdatedBy` longtext DEFAULT NULL,
  `IsDeleted` tinyint(1) NOT NULL,
  `Name` varchar(191) DEFAULT NULL,
  `NormalizedName` varchar(191) DEFAULT NULL,
  `ConcurrencyStamp` longtext DEFAULT NULL,
  PRIMARY KEY (`Id`),
  UNIQUE KEY `RoleNameIndex` (`NormalizedName`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

--
-- Dumping data for table `AspNetRoles`
--

INSERT INTO `AspNetRoles` VALUES
('08de9fac-f86a-4b85-82b9-ae54845d43e1','2026-04-21 13:50:38.490103','2026-04-21 13:50:38.490103',NULL,'System','System',0,'Admin','ADMIN',NULL),
('08de9fac-f8a5-4792-8d81-87f8a0f732a4','2026-04-21 13:50:38.800769','2026-04-21 13:50:38.800769',NULL,'System','System',0,'Teacher','TEACHER',NULL),
('08de9fac-f8d6-4da6-86dc-44c104788045','2026-04-21 13:50:39.121195','2026-04-21 13:50:39.121195',NULL,'System','System',0,'Student','STUDENT',NULL),
('08de9fac-f8d9-4f10-8faf-8e0029a79d6a','2026-04-21 13:50:39.141571','2026-04-21 13:50:39.141571',NULL,'System','System',0,'Parent','PARENT',NULL),
('08de9fac-f8dd-409a-8acc-12b930ee7870','2026-04-21 13:50:39.161717','2026-04-21 13:50:39.161717',NULL,'System','System',0,'Accountant','ACCOUNTANT',NULL),
('08de9fac-f8e0-4b29-88b7-9afe43f587c3','2026-04-21 13:50:39.185745','2026-04-21 13:50:39.185745',NULL,'System','System',0,'Supervisor','SUPERVISOR',NULL),
('08de9fac-f8e2-44e6-81d0-2a844b102446','2026-04-21 13:50:39.196279','2026-04-21 13:50:39.196279',NULL,'System','System',0,'Assistant','ASSISTANT',NULL);
COMMIT;

--
-- Table structure for table `AspNetUserClaims`
--

CREATE TABLE `AspNetUserClaims` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `UserId` char(36) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL,
  `ClaimType` longtext DEFAULT NULL,
  `ClaimValue` longtext DEFAULT NULL,
  PRIMARY KEY (`Id`),
  KEY `IX_AspNetUserClaims_UserId` (`UserId`),
  CONSTRAINT `FK_AspNetUserClaims_AspNetUsers_UserId` FOREIGN KEY (`UserId`) REFERENCES `AspNetUsers` (`Id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

--
-- Dumping data for table `AspNetUserClaims`
--

COMMIT;

--
-- Table structure for table `AspNetUserLogins`
--

CREATE TABLE `AspNetUserLogins` (
  `LoginProvider` varchar(255) NOT NULL,
  `ProviderKey` varchar(255) NOT NULL,
  `ProviderDisplayName` longtext DEFAULT NULL,
  `UserId` char(36) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL,
  PRIMARY KEY (`LoginProvider`,`ProviderKey`),
  KEY `IX_AspNetUserLogins_UserId` (`UserId`),
  CONSTRAINT `FK_AspNetUserLogins_AspNetUsers_UserId` FOREIGN KEY (`UserId`) REFERENCES `AspNetUsers` (`Id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

--
-- Dumping data for table `AspNetUserLogins`
--

COMMIT;

--
-- Table structure for table `AspNetUserRoles`
--

CREATE TABLE `AspNetUserRoles` (
  `UserId` char(36) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL,
  `RoleId` char(36) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL,
  PRIMARY KEY (`UserId`,`RoleId`),
  KEY `IX_AspNetUserRoles_RoleId` (`RoleId`),
  CONSTRAINT `FK_AspNetUserRoles_AspNetRoles_RoleId` FOREIGN KEY (`RoleId`) REFERENCES `AspNetRoles` (`Id`) ON DELETE CASCADE,
  CONSTRAINT `FK_AspNetUserRoles_AspNetUsers_UserId` FOREIGN KEY (`UserId`) REFERENCES `AspNetUsers` (`Id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

--
-- Dumping data for table `AspNetUserRoles`
--

INSERT INTO `AspNetUserRoles` VALUES
('c885f651-20be-4ddf-b7d4-e04e5bb3a9a9','08de9fac-f86a-4b85-82b9-ae54845d43e1');
COMMIT;

--
-- Table structure for table `AspNetUserTokens`
--

CREATE TABLE `AspNetUserTokens` (
  `UserId` char(36) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL,
  `LoginProvider` varchar(255) NOT NULL,
  `Name` varchar(255) NOT NULL,
  `Value` longtext DEFAULT NULL,
  PRIMARY KEY (`UserId`,`LoginProvider`,`Name`),
  CONSTRAINT `FK_AspNetUserTokens_AspNetUsers_UserId` FOREIGN KEY (`UserId`) REFERENCES `AspNetUsers` (`Id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

--
-- Dumping data for table `AspNetUserTokens`
--

COMMIT;

--
-- Dumping data for table `AspNetUsers`
--

COMMIT;

--
-- Table structure for table `Attendances`
--

CREATE TABLE `Attendances` (
  `Id` char(36) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL,
  `Date` date NOT NULL,
  `Status` int(11) NOT NULL,
  `UserId` char(36) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL,
  `Notes` varchar(500) DEFAULT NULL,
  `CreatedAt` datetime(6) NOT NULL,
  `UpdatedAt` datetime(6) DEFAULT NULL,
  `CreatedBy` longtext DEFAULT NULL,
  `UpdatedBy` longtext DEFAULT NULL,
  `IsDeleted` tinyint(1) NOT NULL,
  `DeletedAt` datetime(6) DEFAULT NULL,
  PRIMARY KEY (`Id`),
  UNIQUE KEY `IX_Attendances_UserId_Date` (`UserId`,`Date`),
  CONSTRAINT `FK_Attendances_AspNetUsers_UserId` FOREIGN KEY (`UserId`) REFERENCES `AspNetUsers` (`Id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

--
-- Dumping data for table `Attendances`
--

COMMIT;

--
-- Table structure for table `Badges`
--

CREATE TABLE `Badges` (
  `Id` char(36) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL,
  `StudentId` char(36) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL,
  `Type` int(11) NOT NULL,
  `Month` date NOT NULL,
  `TotalScore` int(11) NOT NULL,
  `CreatedAt` datetime(6) NOT NULL,
  `UpdatedAt` datetime(6) DEFAULT NULL,
  `CreatedBy` longtext DEFAULT NULL,
  `UpdatedBy` longtext DEFAULT NULL,
  `IsDeleted` tinyint(1) NOT NULL,
  `DeletedAt` datetime(6) DEFAULT NULL,
  PRIMARY KEY (`Id`),
  UNIQUE KEY `IX_Badges_StudentId_Month_Type` (`StudentId`,`Month`,`Type`),
  CONSTRAINT `FK_Badges_AspNetUsers_StudentId` FOREIGN KEY (`StudentId`) REFERENCES `AspNetUsers` (`Id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

--
-- Dumping data for table `Badges`
--

COMMIT;

--
-- Table structure for table `Classes`
--

CREATE TABLE `Classes` (
  `Id` char(36) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL,
  `Name` varchar(200) NOT NULL,
  `Type` int(11) NOT NULL,
  `Mode` int(11) NOT NULL,
  `TeacherId` char(36) CHARACTER SET ascii COLLATE ascii_general_ci DEFAULT NULL,
  `AssistantId` char(36) CHARACTER SET ascii COLLATE ascii_general_ci DEFAULT NULL,
  `SupervisorId` char(36) CHARACTER SET ascii COLLATE ascii_general_ci DEFAULT NULL,
  `CreatedAt` datetime(6) NOT NULL,
  `UpdatedAt` datetime(6) DEFAULT NULL,
  `CreatedBy` longtext DEFAULT NULL,
  `UpdatedBy` longtext DEFAULT NULL,
  `IsDeleted` tinyint(1) NOT NULL,
  `DeletedAt` datetime(6) DEFAULT NULL,
  PRIMARY KEY (`Id`),
  KEY `IX_Classes_AssistantId` (`AssistantId`),
  KEY `IX_Classes_SupervisorId` (`SupervisorId`),
  KEY `IX_Classes_TeacherId` (`TeacherId`),
  CONSTRAINT `FK_Classes_AspNetUsers_AssistantId` FOREIGN KEY (`AssistantId`) REFERENCES `AspNetUsers` (`Id`),
  CONSTRAINT `FK_Classes_AspNetUsers_SupervisorId` FOREIGN KEY (`SupervisorId`) REFERENCES `AspNetUsers` (`Id`),
  CONSTRAINT `FK_Classes_AspNetUsers_TeacherId` FOREIGN KEY (`TeacherId`) REFERENCES `AspNetUsers` (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

--
-- Dumping data for table `Classes`
--

COMMIT;

--
-- Table structure for table `CompetitionEntries`
--

CREATE TABLE `CompetitionEntries` (
  `Id` char(36) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL,
  `CompetitionId` char(36) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL,
  `StudentId` char(36) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL,
  `RegisteredAt` datetime(6) NOT NULL,
  `Rank` int(11) DEFAULT NULL,
  `CreatedAt` datetime(6) NOT NULL,
  `UpdatedAt` datetime(6) DEFAULT NULL,
  `CreatedBy` longtext DEFAULT NULL,
  `UpdatedBy` longtext DEFAULT NULL,
  `IsDeleted` tinyint(1) NOT NULL,
  `DeletedAt` datetime(6) DEFAULT NULL,
  PRIMARY KEY (`Id`),
  UNIQUE KEY `IX_CompetitionEntries_CompetitionId_StudentId` (`CompetitionId`,`StudentId`),
  KEY `IX_CompetitionEntries_StudentId` (`StudentId`),
  CONSTRAINT `FK_CompetitionEntries_AspNetUsers_StudentId` FOREIGN KEY (`StudentId`) REFERENCES `AspNetUsers` (`Id`),
  CONSTRAINT `FK_CompetitionEntries_Competitions_CompetitionId` FOREIGN KEY (`CompetitionId`) REFERENCES `Competitions` (`Id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

--
-- Dumping data for table `CompetitionEntries`
--

COMMIT;

--
-- Table structure for table `Competitions`
--

CREATE TABLE `Competitions` (
  `Id` char(36) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL,
  `Title` varchar(500) NOT NULL,
  `Description` varchar(2000) DEFAULT NULL,
  `CreatedById` char(36) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL,
  `IsOpen` tinyint(1) NOT NULL,
  `CreatedAt` datetime(6) NOT NULL,
  `UpdatedAt` datetime(6) DEFAULT NULL,
  `CreatedBy` longtext DEFAULT NULL,
  `UpdatedBy` longtext DEFAULT NULL,
  `IsDeleted` tinyint(1) NOT NULL,
  `DeletedAt` datetime(6) DEFAULT NULL,
  PRIMARY KEY (`Id`),
  KEY `IX_Competitions_CreatedById` (`CreatedById`),
  CONSTRAINT `FK_Competitions_AspNetUsers_CreatedById` FOREIGN KEY (`CreatedById`) REFERENCES `AspNetUsers` (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

--
-- Dumping data for table `Competitions`
--

COMMIT;

--
-- Table structure for table `EducationalContents`
--

CREATE TABLE `EducationalContents` (
  `Id` char(36) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL,
  `Title` varchar(500) NOT NULL,
  `YoutubeUrl` varchar(1000) NOT NULL,
  `Category` int(11) NOT NULL,
  `UploadedById` char(36) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL,
  `Description` varchar(2000) DEFAULT NULL,
  `CreatedAt` datetime(6) NOT NULL,
  `UpdatedAt` datetime(6) DEFAULT NULL,
  `CreatedBy` longtext DEFAULT NULL,
  `UpdatedBy` longtext DEFAULT NULL,
  `IsDeleted` tinyint(1) NOT NULL,
  `DeletedAt` datetime(6) DEFAULT NULL,
  PRIMARY KEY (`Id`),
  KEY `IX_EducationalContents_UploadedById` (`UploadedById`),
  CONSTRAINT `FK_EducationalContents_AspNetUsers_UploadedById` FOREIGN KEY (`UploadedById`) REFERENCES `AspNetUsers` (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

--
-- Dumping data for table `EducationalContents`
--

COMMIT;

--
-- Table structure for table `GradeBookSettings`
--

CREATE TABLE `GradeBookSettings` (
  `Id` char(36) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL,
  `TeacherId` char(36) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL,
  `ExcellentMin` int(11) NOT NULL,
  `VeryGoodMin` int(11) NOT NULL,
  `GoodMin` int(11) NOT NULL,
  `AcceptableMin` int(11) NOT NULL,
  `BatalAlHifzMin` int(11) NOT NULL,
  `RaidAlFaslMin` int(11) NOT NULL,
  `MutafawiqMin` int(11) NOT NULL,
  `CreatedAt` datetime(6) NOT NULL,
  `UpdatedAt` datetime(6) DEFAULT NULL,
  `CreatedBy` longtext DEFAULT NULL,
  `UpdatedBy` longtext DEFAULT NULL,
  `IsDeleted` tinyint(1) NOT NULL,
  `DeletedAt` datetime(6) DEFAULT NULL,
  PRIMARY KEY (`Id`),
  UNIQUE KEY `IX_GradeBookSettings_TeacherId` (`TeacherId`),
  CONSTRAINT `FK_GradeBookSettings_AspNetUsers_TeacherId` FOREIGN KEY (`TeacherId`) REFERENCES `AspNetUsers` (`Id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

--
-- Dumping data for table `GradeBookSettings`
--

COMMIT;

--
-- Dumping data for table `HangfireAggregatedCounter`
--

COMMIT;

--
-- Dumping data for table `HangfireCounter`
--

COMMIT;

--
-- Table structure for table `HangfireDistributedLock`
--

CREATE TABLE `HangfireDistributedLock` (
  `Resource` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_uca1400_ai_ci NOT NULL,
  `CreatedAt` datetime(6) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;

--
-- Dumping data for table `HangfireDistributedLock`
--

COMMIT;

--
-- Dumping data for table `HangfireHash`
--

COMMIT;

--
-- Table structure for table `HangfireJob`
--

CREATE TABLE `HangfireJob` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `StateId` int(11) DEFAULT NULL,
  `StateName` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_uca1400_ai_ci DEFAULT NULL,
  `InvocationData` longtext NOT NULL,
  `Arguments` longtext NOT NULL,
  `CreatedAt` datetime(6) NOT NULL,
  `ExpireAt` datetime(6) DEFAULT NULL,
  PRIMARY KEY (`Id`),
  KEY `IX_HangfireJob_StateName` (`StateName`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;

--
-- Dumping data for table `HangfireJob`
--

COMMIT;

--
-- Table structure for table `HangfireJobParameter`
--

CREATE TABLE `HangfireJobParameter` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `JobId` int(11) NOT NULL,
  `Name` varchar(40) CHARACTER SET utf8mb3 COLLATE utf8mb3_uca1400_ai_ci NOT NULL,
  `Value` longtext DEFAULT NULL,
  PRIMARY KEY (`Id`),
  UNIQUE KEY `IX_HangfireJobParameter_JobId_Name` (`JobId`,`Name`),
  KEY `FK_HangfireJobParameter_Job` (`JobId`),
  CONSTRAINT `FK_HangfireJobParameter_Job` FOREIGN KEY (`JobId`) REFERENCES `HangfireJob` (`Id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;

--
-- Dumping data for table `HangfireJobParameter`
--

COMMIT;

--
-- Dumping data for table `HangfireJobQueue`
--

COMMIT;

--
-- Table structure for table `HangfireJobState`
--

CREATE TABLE `HangfireJobState` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `JobId` int(11) NOT NULL,
  `CreatedAt` datetime(6) NOT NULL,
  `Name` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_uca1400_ai_ci NOT NULL,
  `Reason` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_uca1400_ai_ci DEFAULT NULL,
  `Data` longtext DEFAULT NULL,
  PRIMARY KEY (`Id`),
  KEY `FK_HangfireJobState_Job` (`JobId`),
  CONSTRAINT `FK_HangfireJobState_Job` FOREIGN KEY (`JobId`) REFERENCES `HangfireJob` (`Id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;

--
-- Dumping data for table `HangfireJobState`
--

COMMIT;

--
-- Dumping data for table `HangfireList`
--

COMMIT;

--
-- Table structure for table `HangfireServer`
--

CREATE TABLE `HangfireServer` (
  `Id` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_uca1400_ai_ci NOT NULL,
  `Data` longtext NOT NULL,
  `LastHeartbeat` datetime(6) DEFAULT NULL,
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;

--
-- Dumping data for table `HangfireServer`
--

INSERT INTO `HangfireServer` VALUES
('host-41-131-49-117:34340:67b09df9-d1ac-4968-a54d-9e2623e0770c','{\"WorkerCount\":20,\"Queues\":[\"default\"],\"StartedAt\":\"2026-04-21T13:50:41.1968838Z\"}','2026-04-22 09:26:58.075678');
COMMIT;

--
-- Dumping data for table `HangfireSet`
--

COMMIT;

--
-- Table structure for table `HangfireState`
--

CREATE TABLE `HangfireState` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `JobId` int(11) NOT NULL,
  `Name` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_uca1400_ai_ci NOT NULL,
  `Reason` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_uca1400_ai_ci DEFAULT NULL,
  `CreatedAt` datetime(6) NOT NULL,
  `Data` longtext DEFAULT NULL,
  PRIMARY KEY (`Id`),
  KEY `FK_HangfireHangFire_State_Job` (`JobId`),
  CONSTRAINT `FK_HangfireHangFire_State_Job` FOREIGN KEY (`JobId`) REFERENCES `HangfireJob` (`Id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;

--
-- Dumping data for table `HangfireState`
--

COMMIT;

--
-- Table structure for table `Messages`
--

CREATE TABLE `Messages` (
  `Id` char(36) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL,
  `SenderId` char(36) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL,
  `ReceiverId` char(36) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL,
  `Content` varchar(4000) NOT NULL,
  `IsRead` tinyint(1) NOT NULL,
  `ParentMessageId` char(36) CHARACTER SET ascii COLLATE ascii_general_ci DEFAULT NULL,
  `CreatedAt` datetime(6) NOT NULL,
  `UpdatedAt` datetime(6) DEFAULT NULL,
  `CreatedBy` longtext DEFAULT NULL,
  `UpdatedBy` longtext DEFAULT NULL,
  `IsDeleted` tinyint(1) NOT NULL,
  `DeletedAt` datetime(6) DEFAULT NULL,
  PRIMARY KEY (`Id`),
  KEY `IX_Messages_ParentMessageId` (`ParentMessageId`),
  KEY `IX_Messages_ReceiverId` (`ReceiverId`),
  KEY `IX_Messages_SenderId` (`SenderId`),
  CONSTRAINT `FK_Messages_AspNetUsers_ReceiverId` FOREIGN KEY (`ReceiverId`) REFERENCES `AspNetUsers` (`Id`),
  CONSTRAINT `FK_Messages_AspNetUsers_SenderId` FOREIGN KEY (`SenderId`) REFERENCES `AspNetUsers` (`Id`),
  CONSTRAINT `FK_Messages_Messages_ParentMessageId` FOREIGN KEY (`ParentMessageId`) REFERENCES `Messages` (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

--
-- Dumping data for table `Messages`
--

COMMIT;

--
-- Table structure for table `MonthlyQuestions`
--

CREATE TABLE `MonthlyQuestions` (
  `Id` char(36) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL,
  `TeacherId` char(36) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL,
  `ClassId` char(36) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL,
  `QuestionText` varchar(2000) NOT NULL,
  `Month` date NOT NULL,
  `IsActive` tinyint(1) NOT NULL,
  `CreatedAt` datetime(6) NOT NULL,
  `UpdatedAt` datetime(6) DEFAULT NULL,
  `CreatedBy` longtext DEFAULT NULL,
  `UpdatedBy` longtext DEFAULT NULL,
  `IsDeleted` tinyint(1) NOT NULL,
  `DeletedAt` datetime(6) DEFAULT NULL,
  PRIMARY KEY (`Id`),
  KEY `IX_MonthlyQuestions_ClassId` (`ClassId`),
  KEY `IX_MonthlyQuestions_TeacherId` (`TeacherId`),
  CONSTRAINT `FK_MonthlyQuestions_AspNetUsers_TeacherId` FOREIGN KEY (`TeacherId`) REFERENCES `AspNetUsers` (`Id`),
  CONSTRAINT `FK_MonthlyQuestions_Classes_ClassId` FOREIGN KEY (`ClassId`) REFERENCES `Classes` (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

--
-- Dumping data for table `MonthlyQuestions`
--

COMMIT;

--
-- Dumping data for table `OpenIddictApplications`
--

COMMIT;

--
-- Dumping data for table `OpenIddictAuthorizations`
--

COMMIT;

--
-- Dumping data for table `OpenIddictScopes`
--

COMMIT;

--
-- Dumping data for table `OpenIddictTokens`
--

COMMIT;

--
-- Table structure for table `Payments`
--

CREATE TABLE `Payments` (
  `Id` char(36) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL,
  `Date` datetime(6) NOT NULL,
  `SubscriptionId` char(36) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL,
  `CreatedAt` datetime(6) NOT NULL,
  `UpdatedAt` datetime(6) DEFAULT NULL,
  `CreatedBy` longtext DEFAULT NULL,
  `UpdatedBy` longtext DEFAULT NULL,
  `IsDeleted` tinyint(1) NOT NULL,
  `DeletedAt` datetime(6) DEFAULT NULL,
  PRIMARY KEY (`Id`),
  KEY `IX_Payments_SubscriptionId` (`SubscriptionId`),
  CONSTRAINT `FK_Payments_Subscriptions_SubscriptionId` FOREIGN KEY (`SubscriptionId`) REFERENCES `Subscriptions` (`Id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

--
-- Dumping data for table `Payments`
--

COMMIT;

--
-- Table structure for table `QuestionAnswers`
--

CREATE TABLE `QuestionAnswers` (
  `Id` char(36) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL,
  `QuestionId` char(36) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL,
  `StudentId` char(36) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL,
  `AnswerText` varchar(4000) NOT NULL,
  `Grade` int(11) DEFAULT NULL,
  `TeacherFeedback` varchar(1000) DEFAULT NULL,
  `CreatedAt` datetime(6) NOT NULL,
  `UpdatedAt` datetime(6) DEFAULT NULL,
  `CreatedBy` longtext DEFAULT NULL,
  `UpdatedBy` longtext DEFAULT NULL,
  `IsDeleted` tinyint(1) NOT NULL,
  `DeletedAt` datetime(6) DEFAULT NULL,
  PRIMARY KEY (`Id`),
  UNIQUE KEY `IX_QuestionAnswers_QuestionId_StudentId` (`QuestionId`,`StudentId`),
  KEY `IX_QuestionAnswers_StudentId` (`StudentId`),
  CONSTRAINT `FK_QuestionAnswers_AspNetUsers_StudentId` FOREIGN KEY (`StudentId`) REFERENCES `AspNetUsers` (`Id`),
  CONSTRAINT `FK_QuestionAnswers_MonthlyQuestions_QuestionId` FOREIGN KEY (`QuestionId`) REFERENCES `MonthlyQuestions` (`Id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

--
-- Dumping data for table `QuestionAnswers`
--

COMMIT;

--
-- Table structure for table `Recitations`
--

CREATE TABLE `Recitations` (
  `Id` char(36) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL,
  `StudentId` char(36) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL,
  `TeacherId` char(36) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL,
  `Date` date NOT NULL,
  `AyahsCount` int(11) NOT NULL,
  `Type` int(11) NOT NULL,
  `Grade` int(11) NOT NULL,
  `Notes` varchar(1000) DEFAULT NULL,
  `CreatedAt` datetime(6) NOT NULL,
  `UpdatedAt` datetime(6) DEFAULT NULL,
  `CreatedBy` longtext DEFAULT NULL,
  `UpdatedBy` longtext DEFAULT NULL,
  `IsDeleted` tinyint(1) NOT NULL,
  `DeletedAt` datetime(6) DEFAULT NULL,
  PRIMARY KEY (`Id`),
  KEY `IX_Recitations_StudentId` (`StudentId`),
  KEY `IX_Recitations_TeacherId` (`TeacherId`),
  CONSTRAINT `FK_Recitations_AspNetUsers_StudentId` FOREIGN KEY (`StudentId`) REFERENCES `AspNetUsers` (`Id`),
  CONSTRAINT `FK_Recitations_AspNetUsers_TeacherId` FOREIGN KEY (`TeacherId`) REFERENCES `AspNetUsers` (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

--
-- Dumping data for table `Recitations`
--

COMMIT;

--
-- Table structure for table `Salaries`
--

CREATE TABLE `Salaries` (
  `Id` char(36) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL,
  `UserId` char(36) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL,
  `Role` int(11) NOT NULL,
  `Amount` decimal(18,2) NOT NULL,
  `Status` int(11) NOT NULL,
  `SalaryMonth` date NOT NULL,
  `PaidAt` datetime(6) DEFAULT NULL,
  `Notes` varchar(500) DEFAULT NULL,
  `CreatedAt` datetime(6) NOT NULL,
  `UpdatedAt` datetime(6) DEFAULT NULL,
  `CreatedBy` longtext DEFAULT NULL,
  `UpdatedBy` longtext DEFAULT NULL,
  `IsDeleted` tinyint(1) NOT NULL,
  `DeletedAt` datetime(6) DEFAULT NULL,
  PRIMARY KEY (`Id`),
  UNIQUE KEY `IX_Salaries_UserId_SalaryMonth` (`UserId`,`SalaryMonth`),
  CONSTRAINT `FK_Salaries_AspNetUsers_UserId` FOREIGN KEY (`UserId`) REFERENCES `AspNetUsers` (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

--
-- Dumping data for table `Salaries`
--

COMMIT;

--
-- Table structure for table `Subscriptions`
--

CREATE TABLE `Subscriptions` (
  `Id` char(36) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL,
  `Type` int(11) NOT NULL,
  `Mode` int(11) NOT NULL,
  `Amount` decimal(18,2) NOT NULL,
  `PaymentMethod` int(11) NOT NULL,
  `PaymentDate` date NOT NULL,
  `StudentId` char(36) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL,
  `CreatedAt` datetime(6) NOT NULL,
  `UpdatedAt` datetime(6) DEFAULT NULL,
  `CreatedBy` longtext DEFAULT NULL,
  `UpdatedBy` longtext DEFAULT NULL,
  `IsDeleted` tinyint(1) NOT NULL,
  `DeletedAt` datetime(6) DEFAULT NULL,
  PRIMARY KEY (`Id`),
  KEY `IX_Subscriptions_StudentId` (`StudentId`),
  CONSTRAINT `FK_Subscriptions_AspNetUsers_StudentId` FOREIGN KEY (`StudentId`) REFERENCES `AspNetUsers` (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

--
-- Dumping data for table `Subscriptions`
--

COMMIT;


