-- CreateTable
CREATE TABLE `notifications` (
    `id` INTEGER NOT NULL AUTO_INCREMENT,
    `title` VARCHAR(255) NOT NULL,
    `message` TEXT NOT NULL,
    `type` ENUM('NEW_TRAINING_MODULE', 'TRAINING_REMINDER_24H', 'TRAINING_REMINDER_12H', 'TRAINING_REMINDER_1H', 'TRAINING_STARTED', 'TRAINING_CONTENT_UPDATE', 'TRAINING_FEEDBACK_REQUEST', 'NEW_COACHING_REQUEST', 'COACHING_REQUEST_TAKEN', 'COACHING_SCHEDULED', 'COACHING_REMINDER_24H', 'COACHING_REMINDER_12H', 'COACHING_REMINDER_1H', 'COACHING_STARTED', 'COACHING_FEEDBACK_REQUEST') NOT NULL,
    `read` BOOLEAN NOT NULL DEFAULT false,
    `data` JSON NULL,
    `user_id` INTEGER NOT NULL,
    `created_at` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
    `updated_at` DATETIME(3) NOT NULL,

    INDEX `notifications_user_id_idx`(`user_id`),
    INDEX `notifications_type_idx`(`type`),
    INDEX `notifications_read_idx`(`read`),
    PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

-- AddForeignKey
ALTER TABLE `notifications` ADD CONSTRAINT `notifications_user_id_fkey` FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
