--
-- Host: localhost    Database: desafiointeligencias
-- ------------------------------------------------------


--
-- Table structure for table `achievements`
--

CREATE TABLE `achievements` (
  `id` int NOT NULL AUTO_INCREMENT,
  `title` varchar(100) NOT NULL,
  `description` text,
  `category` enum('seed','sprout','tree','special') NOT NULL,
  `intelligence_id` int DEFAULT NULL,
  `threshold` int DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `intelligence_id` (`intelligence_id`),
  CONSTRAINT `achievements_ibfk_1` FOREIGN KEY (`intelligence_id`) REFERENCES `intelligences` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `achievements`
--

INSERT INTO `achievements` (`id`,`title`,`description`,`category`,`intelligence_id`,`threshold`,`created_at`) VALUES
  (1,'Primeiro Passo','Complete o primeiro dia de jornada','seed',1,1,'2025-11-15 15:54:03'),
  (2,'Equipe Afinada','Finalize um desafio em família','sprout',2,1,'2025-11-15 15:54:03');

--
-- Table structure for table `challenge_responses`
--

CREATE TABLE `challenge_responses` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int NOT NULL,
  `challenge_id` int NOT NULL,
  `response_text` text,
  `response_audio_url` varchar(255) DEFAULT NULL,
  `response_image_url` varchar(255) DEFAULT NULL,
  `validation_status` enum('pending','valid','invalid','manual_review') NOT NULL DEFAULT 'manual_review',
  `validation_feedback` text,
  `submitted_at` datetime NOT NULL,
  `validated_at` datetime DEFAULT NULL,
  `points_earned` int NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `user_id` (`user_id`),
  KEY `challenge_id` (`challenge_id`),
  CONSTRAINT `challenge_responses_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  CONSTRAINT `challenge_responses_ibfk_2` FOREIGN KEY (`challenge_id`) REFERENCES `challenges` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `challenge_responses`
--

INSERT INTO `challenge_responses` (`id`,`user_id`,`challenge_id`,`response_text`,`response_audio_url`,`response_image_url`,`validation_status`,`validation_feedback`,`submitted_at`,`validated_at`,`points_earned`) VALUES
  (1,2,1,'Compartilhei minhas emoções em casa.',NULL,NULL,'valid','Excelente abertura para o diálogo!','2025-11-15 12:05:00','2025-11-15 12:45:00',20);

--
-- Table structure for table `challenges`
--

CREATE TABLE `challenges` (
  `id` int NOT NULL AUTO_INCREMENT,
  `day_id` int DEFAULT NULL,
  `title` varchar(150) NOT NULL,
  `description` text,
  `start_time` datetime DEFAULT NULL,
  `end_time` datetime DEFAULT NULL,
  `points` int NOT NULL DEFAULT '0',
  `is_special` tinyint(1) NOT NULL DEFAULT '0',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `day_id` (`day_id`),
  CONSTRAINT `challenges_ibfk_1` FOREIGN KEY (`day_id`) REFERENCES `days` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `challenges`
--

INSERT INTO `challenges` (`id`,`day_id`,`title`,`description`,`start_time`,`end_time`,`points`,`is_special`,`created_at`) VALUES
  (1,1,'Mapa das Emoções','Liste três emoções sentidas hoje e compartilhe com alguém.','2025-11-10 09:00:00','2025-12-31 21:00:00',20,0,'2025-11-15 15:54:03'),
  (2,3,'Missão Colaborativa','Planeje uma atividade em grupo onde cada pessoa tenha um papel.','2025-11-12 09:00:00','2025-12-31 21:00:00',30,1,'2025-11-15 15:54:03'),
  (3,2,'Gratidão em Família','Escreva ou grave um agradecimento para alguém e compartilhe.','2025-11-15 09:00:00','2025-12-31 21:00:00',25,0,'2025-11-15 15:54:03');

--
-- Table structure for table `daily_challenges`
--

CREATE TABLE `daily_challenges` (
  `id` int NOT NULL AUTO_INCREMENT,
  `challenge_date` date NOT NULL,
  `title` varchar(150) NOT NULL,
  `description` text,
  `intelligence_id` int DEFAULT NULL,
  `language` enum('pt','es','en') NOT NULL DEFAULT 'pt',
  `points` int NOT NULL DEFAULT '0',
  `video_url` varchar(255) DEFAULT NULL,
  `video_duration` varchar(50) DEFAULT NULL,
  `badge_label` varchar(120) DEFAULT NULL,
  `response_type` enum('text','audio','image','video','upload','quiz','mixed') NOT NULL DEFAULT 'text',
  `quiz_id` int DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `intelligence_id` (`intelligence_id`),
  KEY `quiz_id` (`quiz_id`),
  CONSTRAINT `daily_challenges_ibfk_1` FOREIGN KEY (`intelligence_id`) REFERENCES `intelligences` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `daily_challenges`
--

INSERT INTO `daily_challenges` (`id`,`challenge_date`,`title`,`description`,`intelligence_id`,`language`,`points`,`video_url`,`video_duration`,`badge_label`,`response_type`,`quiz_id`,`is_active`,`created_at`) VALUES
  (1,'2025-11-23','Mapa das Emoções','Liste três emoções sentidas hoje e compartilhe com alguém.',1,'pt',20,'https://cdn.example.com/videos/mapa-emocoes.mp4','02:15','Trabalha: Inteligência Emocional','text',NULL,1,'2025-11-22 20:00:00'),
  (2,'2025-11-23','Missão Colaborativa','Planeje uma atividade em grupo onde cada pessoa tenha um papel.',2,'pt',25,NULL,NULL,'Trabalha: Colaboração','upload',NULL,1,'2025-11-22 20:00:00'),
  (3,'2025-11-23','Gratidão em Família','Escreva ou grave um agradecimento para alguém e compartilhe.',1,'pt',15,NULL,NULL,'Trabalha: Empatia','audio',NULL,1,'2025-11-22 20:00:00');

--
-- Table structure for table `daily_challenge_contents`
--

CREATE TABLE `daily_challenge_contents` (
  `id` int NOT NULL AUTO_INCREMENT,
  `daily_challenge_id` int NOT NULL,
  `content_type` enum('text','image','audio','video','pdf','link','quiz','movie','challenge') NOT NULL DEFAULT 'text',
  `language` enum('pt','es','en') NOT NULL DEFAULT 'pt',
  `order_index` smallint NOT NULL DEFAULT '0',
  `title` varchar(150) DEFAULT NULL,
  `body_text` text,
  `media_url` varchar(255) DEFAULT NULL,
  `reference_id` int DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `daily_challenge_id` (`daily_challenge_id`),
  CONSTRAINT `daily_challenge_contents_ibfk_1` FOREIGN KEY (`daily_challenge_id`) REFERENCES `daily_challenges` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `daily_challenge_contents`
--

INSERT INTO `daily_challenge_contents` (`id`,`daily_challenge_id`,`content_type`,`language`,`order_index`,`title`,`body_text`,`media_url`,`reference_id`,`created_at`) VALUES
  (1,1,'text','pt',1,'Instruções','Anote três emoções que surgiram no seu dia e converse com alguém de confiança.',NULL,NULL,'2025-11-22 20:00:00'),
  (2,1,'video','pt',2,'Vídeo inspiração','Veja o vídeo rápido antes de responder.','https://cdn.example.com/videos/mapa-emocoes.mp4',NULL,'2025-11-22 20:00:00'),
  (3,2,'text','pt',1,'Organize o plano','Distribua papéis entre os participantes e defina o objetivo da missão.',NULL,NULL,'2025-11-22 20:00:00'),
  (4,3,'audio','pt',1,'Compartilhe gratidão','Grave um áudio agradecendo alguém especial e envie para a família.',NULL,NULL,'2025-11-22 20:00:00');

--
-- Table structure for table `user_daily_challenges`
--

CREATE TABLE `user_daily_challenges` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int NOT NULL,
  `daily_challenge_id` int NOT NULL,
  `started_at` datetime DEFAULT NULL,
  `completed_at` datetime DEFAULT NULL,
  `points_earned` int NOT NULL DEFAULT '0',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uq_user_daily` (`user_id`,`daily_challenge_id`),
  KEY `daily_challenge_id` (`daily_challenge_id`),
  CONSTRAINT `user_daily_challenges_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  CONSTRAINT `user_daily_challenges_ibfk_2` FOREIGN KEY (`daily_challenge_id`) REFERENCES `daily_challenges` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `user_daily_challenges`
--

INSERT INTO `user_daily_challenges` (`id`,`user_id`,`daily_challenge_id`,`started_at`,`completed_at`,`points_earned`,`created_at`) VALUES
  (1,2,1,'2025-11-23 09:10:00','2025-11-23 09:25:00',20,'2025-11-23 09:10:00');

--
-- Table structure for table `daily_challenge_responses`
--

CREATE TABLE `daily_challenge_responses` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int NOT NULL,
  `daily_challenge_id` int NOT NULL,
  `response_text` text,
  `response_audio_url` varchar(255) DEFAULT NULL,
  `response_image_url` varchar(255) DEFAULT NULL,
  `validation_status` enum('pending','valid','invalid','manual_review') NOT NULL DEFAULT 'manual_review',
  `validation_feedback` text,
  `submitted_at` datetime NOT NULL,
  `validated_at` datetime DEFAULT NULL,
  `points_earned` int NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `user_id` (`user_id`),
  KEY `daily_challenge_id` (`daily_challenge_id`),
  CONSTRAINT `daily_challenge_responses_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  CONSTRAINT `daily_challenge_responses_ibfk_2` FOREIGN KEY (`daily_challenge_id`) REFERENCES `daily_challenges` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `daily_challenge_responses`
--

INSERT INTO `daily_challenge_responses` (`id`,`user_id`,`daily_challenge_id`,`response_text`,`response_audio_url`,`response_image_url`,`validation_status`,`validation_feedback`,`submitted_at`,`validated_at`,`points_earned`) VALUES
  (1,2,1,'Compartilhei três emoções com minha mãe.',NULL,NULL,'manual_review',NULL,'2025-11-23 09:20:00',NULL,20);

--
-- Table structure for table `classes`
--

CREATE TABLE `classes` (
  `id` int NOT NULL AUTO_INCREMENT,
  `school_id` int NOT NULL,
  `name` varchar(100) NOT NULL,
  `description` text,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `school_id` (`school_id`),
  CONSTRAINT `classes_ibfk_1` FOREIGN KEY (`school_id`) REFERENCES `schools` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `classes`
--

INSERT INTO `classes` VALUES (1,1,'Turma 1A','Turma do primeiro ano A','2025-11-15 15:54:03'),(2,1,'Turma 1B','Turma do primeiro ano B','2025-11-15 15:54:03'),(3,2,'Turma 2A','Turma do segundo ano A','2025-11-15 15:54:03');

--
-- Table structure for table `coins_transactions`
--

CREATE TABLE `coins_transactions` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int NOT NULL,
  `amount` int NOT NULL,
  `transaction_type` enum('earned','spent','reverted') NOT NULL,
  `source` varchar(50) NOT NULL,
  `reference_id` int DEFAULT NULL,
  `description` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `user_id` (`user_id`),
  CONSTRAINT `coins_transactions_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `coins_transactions`
--

INSERT INTO `coins_transactions` (`id`,`user_id`,`amount`,`transaction_type`,`source`,`reference_id`,`description`,`created_at`) VALUES
  (1,2,30,'earned','day_completion',1,'Concluiu o Dia 1 e recebeu moedas.','2025-11-15 11:05:00'),
  (2,2,10,'spent','reward_redeem',1,'Resgatou o pôster digital.','2025-11-15 12:40:00');

--
-- Table structure for table `day_contents`
--

CREATE TABLE `day_contents` (
  `id` int NOT NULL AUTO_INCREMENT,
  `day_id` int NOT NULL,
  `content_type` enum('text','image','audio','video','pdf','link','quiz','movie','challenge') NOT NULL,
  `language` enum('pt','es','en') NOT NULL DEFAULT 'pt',
  `order_index` smallint NOT NULL DEFAULT '0',
  `title` varchar(150) DEFAULT NULL,
  `body_text` text,
  `media_url` varchar(255) DEFAULT NULL,
  `reference_id` int DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `day_id` (`day_id`),
  CONSTRAINT `day_contents_ibfk_1` FOREIGN KEY (`day_id`) REFERENCES `days` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `day_contents`
--

INSERT INTO `day_contents` (`id`,`day_id`,`content_type`,`language`,`order_index`,`title`,`body_text`,`media_url`,`reference_id`,`created_at`) VALUES
  (1,1,'text','pt',1,'Respire fundo','Reserve 5 minutos para identificar como você está se sentindo hoje.',NULL,NULL,'2025-11-15 15:54:03'),
  (2,1,'movie','pt',2,'Curta do dia','Assista ao vídeo recomendado para entender emoções.','https://cdn.example.com/movies/inside-out.mp4',NULL,'2025-11-15 15:54:03'),
  (3,1,'challenge','pt',3,'Desafio em família','Compartilhe uma emoção com sua família e ouça a deles.','https://cdn.example.com/challenges/familia.pdf',NULL,'2025-11-15 15:54:03');

--
-- Table structure for table `days`
--

CREATE TABLE `days` (
  `id` int NOT NULL AUTO_INCREMENT,
  `trail_id` int NOT NULL,
  `day_number` tinyint NOT NULL,
  `day_type` enum('content','family_challenge','special') NOT NULL DEFAULT 'content',
  `release_time` datetime NOT NULL,
  `description` text,
  `video_url` varchar(255) DEFAULT NULL,
  `title` varchar(150) NOT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `trail_id` (`trail_id`),
  CONSTRAINT `days_ibfk_1` FOREIGN KEY (`trail_id`) REFERENCES `trails` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `days`
--

INSERT INTO `days` (`id`,`trail_id`,`day_number`,`day_type`,`release_time`,`description`,`video_url`,`title`,`created_at`) VALUES
  (1,1,1,'content','2025-11-10 08:00:00','Bem-vindo ao desafio, vamos reconhecer emoções básicas.','https://cdn.example.com/videos/dia1.mp4','Dia 1 - Emoções','2025-11-15 15:54:03'),
  (2,1,2,'content','2025-11-11 08:00:00','Hora de aprofundar e nomear sentimentos.','https://cdn.example.com/videos/dia2.mp4','Dia 2 - Sentimentos','2025-11-15 15:54:03'),
  (3,2,1,'family_challenge','2025-11-10 08:00:00','Atividade colaborativa para a família.','https://cdn.example.com/videos/dia3.mp4','Dia 1 - Colaboração','2025-11-15 15:54:03');

--
-- Table structure for table `families`
--

CREATE TABLE `families` (
  `id` int NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `families`
--

INSERT INTO `families` (`id`,`name`,`created_at`) VALUES
  (1,'Família Massari','2025-11-15 15:54:03');

--
-- Table structure for table `intelligences`
--

CREATE TABLE `intelligences` (
  `id` int NOT NULL AUTO_INCREMENT,
  `name_pt` varchar(100) NOT NULL,
  `name_es` varchar(100) NOT NULL,
  `name_en` varchar(100) NOT NULL,
  `description` text,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `intelligences`
--

INSERT INTO `intelligences` (`id`,`name_pt`,`name_es`,`name_en`,`description`,`created_at`) VALUES
  (1,'Autoconhecimento','Autoconocimiento','Self Awareness','Aprender a identificar as próprias emoções.','2025-11-15 15:54:03'),
  (2,'Colaboração','Colaboración','Collaboration','Desenvolver habilidades para trabalhar em equipe.','2025-11-15 15:54:03');

--
-- Table structure for table `movies`
--

CREATE TABLE `movies` (
  `id` int NOT NULL AUTO_INCREMENT,
  `day_id` int NOT NULL,
  `title` varchar(150) NOT NULL,
  `description` text,
  `video_url` varchar(255) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `day_id` (`day_id`),
  CONSTRAINT `movies_ibfk_1` FOREIGN KEY (`day_id`) REFERENCES `days` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `movies`
--

INSERT INTO `movies` (`id`,`day_id`,`title`,`description`,`video_url`,`created_at`) VALUES
  (1,1,'Inside Out Moment','Cena curta para entender emoções.','https://cdn.example.com/movies/inside-out.mp4','2025-11-15 15:54:03'),
  (2,2,'Teen Talk','Depoimento sobre sentimentos e convivência.','https://cdn.example.com/movies/teen-talk.mp4','2025-11-15 15:54:03');

--
-- Table structure for table `notifications`
--

CREATE TABLE `notifications` (
  `id` int NOT NULL AUTO_INCREMENT,
  `title` varchar(150) NOT NULL,
  `message` text NOT NULL,
  `send_time` datetime NOT NULL,
  `language` enum('pt','es','en') NOT NULL DEFAULT 'pt',
  `target_type` enum('all','class','family','user') NOT NULL,
  `target_id` int DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `notifications`
--

INSERT INTO `notifications` (`id`,`title`,`message`,`send_time`,`language`,`target_type`,`target_id`,`created_at`) VALUES
  (1,'Novo dia liberado','O Dia 2 já está disponível para você continuar sua jornada.','2025-11-11 08:00:00','pt','user',2,'2025-11-11 08:00:00');

--
-- Table structure for table `progress_intelligence`
--

CREATE TABLE `progress_intelligence` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int NOT NULL,
  `intelligence_id` int NOT NULL,
  `progress_percent` decimal(5,2) NOT NULL DEFAULT '0.00',
  `streak_days` int NOT NULL DEFAULT '0',
  `last_activity` date DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uq_progress` (`user_id`,`intelligence_id`),
  KEY `intelligence_id` (`intelligence_id`),
  CONSTRAINT `progress_intelligence_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  CONSTRAINT `progress_intelligence_ibfk_2` FOREIGN KEY (`intelligence_id`) REFERENCES `intelligences` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `progress_intelligence`
--

INSERT INTO `progress_intelligence` (`id`,`user_id`,`intelligence_id`,`progress_percent`,`streak_days`,`last_activity`,`created_at`) VALUES
  (1,2,1,35.00,2,'2025-11-15','2025-11-15 18:00:00');

--
-- Table structure for table `quiz_options`
--

CREATE TABLE `quiz_options` (
  `id` int NOT NULL AUTO_INCREMENT,
  `quiz_id` int NOT NULL,
  `option_text` varchar(255) NOT NULL,
  `is_correct` tinyint(1) NOT NULL DEFAULT '0',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `quiz_id` (`quiz_id`),
  CONSTRAINT `quiz_options_ibfk_1` FOREIGN KEY (`quiz_id`) REFERENCES `quizzes` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `quiz_options`
--

INSERT INTO `quiz_options` (`id`,`quiz_id`,`option_text`,`is_correct`,`created_at`) VALUES
  (1,1,'Observar apenas como outras pessoas se sentem',0,'2025-11-15 15:54:03'),
  (2,1,'Ignorar sentimentos difíceis',0,'2025-11-15 15:54:03'),
  (3,1,'Identificar o que você sente no momento',1,'2025-11-15 15:54:03'),
  (4,1,'Compartilhar tudo nas redes sociais',0,'2025-11-15 15:54:03'),
  (5,2,'Verdadeiro',1,'2025-11-15 15:54:03'),
  (6,2,'Falso',0,'2025-11-15 15:54:03');

--
-- Table structure for table `quiz_pairs`
--

CREATE TABLE `quiz_pairs` (
  `id` int NOT NULL AUTO_INCREMENT,
  `quiz_id` int NOT NULL,
  `prompt` varchar(255) NOT NULL,
  `match` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `quiz_id` (`quiz_id`),
  CONSTRAINT `quiz_pairs_ibfk_1` FOREIGN KEY (`quiz_id`) REFERENCES `quizzes` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `quiz_pairs`
--


--
-- Table structure for table `quizzes`
--

CREATE TABLE `quizzes` (
  `id` int NOT NULL AUTO_INCREMENT,
  `day_id` int DEFAULT NULL,
  `daily_challenge_id` int DEFAULT NULL,
  `quiz_type` enum('multiple_choice','true_false','match','fill_in','essay','photo','audio') NOT NULL,
  `question` text NOT NULL,
  `language` enum('pt','es','en') NOT NULL DEFAULT 'pt',
  `points` int NOT NULL DEFAULT '1',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `day_id` (`day_id`),
  KEY `daily_challenge_id` (`daily_challenge_id`),
  CONSTRAINT `quizzes_ibfk_1` FOREIGN KEY (`day_id`) REFERENCES `days` (`id`) ON DELETE SET NULL,
  CONSTRAINT `quizzes_ibfk_2` FOREIGN KEY (`daily_challenge_id`) REFERENCES `daily_challenges` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `quizzes`
--

INSERT INTO `quizzes` (`id`,`day_id`,`daily_challenge_id`,`quiz_type`,`question`,`language`,`points`,`created_at`) VALUES
  (1,1,NULL,'multiple_choice','Qual é a primeira etapa para entender suas emoções?','pt',5,'2025-11-15 15:54:03'),
  (2,2,NULL,'true_false','É possível sentir mais de uma emoção ao mesmo tempo?','pt',3,'2025-11-15 15:54:03');

--
-- Table structure for table `referrals`
--

CREATE TABLE `referrals` (
  `id` int NOT NULL AUTO_INCREMENT,
  `referrer_id` int NOT NULL,
  `referral_code` varchar(20) NOT NULL,
  `referred_email` varchar(150) DEFAULT NULL,
  `referred_user_id` int DEFAULT NULL,
  `status` enum('pending','accepted','rejected') NOT NULL DEFAULT 'pending',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `accepted_at` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `referral_code` (`referral_code`),
  KEY `referrer_id` (`referrer_id`),
  KEY `referred_user_id` (`referred_user_id`),
  CONSTRAINT `referrals_ibfk_1` FOREIGN KEY (`referrer_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  CONSTRAINT `referrals_ibfk_2` FOREIGN KEY (`referred_user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `referrals`
--

INSERT INTO `referrals` VALUES (1,2,'65230E84',NULL,NULL,'pending','2025-11-15 16:02:15',NULL),(2,6,'35040DC7',NULL,NULL,'pending','2025-11-15 18:27:14',NULL);

--
-- Table structure for table `rewards`
--

CREATE TABLE `rewards` (
  `id` int NOT NULL AUTO_INCREMENT,
  `title` varchar(150) NOT NULL,
  `description` text,
  `cost_coins` int NOT NULL,
  `available_quantity` int DEFAULT NULL,
  `valid_from` date DEFAULT NULL,
  `valid_to` date DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `rewards`
--

INSERT INTO `rewards` (`id`,`title`,`description`,`cost_coins`,`available_quantity`,`valid_from`,`valid_to`,`created_at`) VALUES
  (1,'Poster Digital','Arte exclusiva do desafio para imprimir em casa.',10,100,'2025-11-10','2025-12-31','2025-11-15 15:54:03');

--
-- Table structure for table `schools`
--

CREATE TABLE `schools` (
  `id` int NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL,
  `location` varchar(150) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `schools`
--

INSERT INTO `schools` VALUES (1,'Escola Alfa','Cidade A','2025-11-15 15:54:03'),(2,'Escola Beta','Cidade B','2025-11-15 15:54:03');

--
-- Table structure for table `testimonials`
--

CREATE TABLE `testimonials` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int NOT NULL,
  `rating` tinyint NOT NULL,
  `comment` text NOT NULL,
  `approved` tinyint(1) NOT NULL DEFAULT '0',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `user_id` (`user_id`),
  CONSTRAINT `testimonials_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `testimonials`
--

INSERT INTO `testimonials` (`id`,`user_id`,`rating`,`comment`,`approved`,`created_at`) VALUES
  (1,2,5,'Aplicativo incrível para conversar sobre sentimentos.',1,'2025-11-15 13:00:00');

--
-- Table structure for table `trails`
--

CREATE TABLE `trails` (
  `id` int NOT NULL AUTO_INCREMENT,
  `intelligence_id` int NOT NULL,
  `week_number` int NOT NULL,
  `title` varchar(150) NOT NULL,
  `description` text,
  `available_from` date NOT NULL,
  `available_to` date DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `intelligence_id` (`intelligence_id`),
  CONSTRAINT `trails_ibfk_1` FOREIGN KEY (`intelligence_id`) REFERENCES `intelligences` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `trails`
--

INSERT INTO `trails` (`id`,`intelligence_id`,`week_number`,`title`,`description`,`available_from`,`available_to`,`created_at`) VALUES
  (1,1,1,'Semana 1 - Autoconhecimento','Primeiros passos para identificar emoções.','2025-11-10','2025-11-17','2025-11-15 15:54:03'),
  (2,2,1,'Semana 1 - Colaboração','Atividades para fortalecer o trabalho em equipe.','2025-11-10','2025-11-17','2025-11-15 15:54:03');

--
-- Table structure for table `user_achievements`
--

CREATE TABLE `user_achievements` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int NOT NULL,
  `achievement_id` int NOT NULL,
  `earned_at` datetime NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uq_user_achievement` (`user_id`,`achievement_id`),
  KEY `achievement_id` (`achievement_id`),
  CONSTRAINT `user_achievements_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  CONSTRAINT `user_achievements_ibfk_2` FOREIGN KEY (`achievement_id`) REFERENCES `achievements` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `user_achievements`
--

INSERT INTO `user_achievements` (`id`,`user_id`,`achievement_id`,`earned_at`) VALUES
  (1,2,1,'2025-11-15 11:10:00');

--
-- Table structure for table `user_challenges`
--

CREATE TABLE `user_challenges` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int NOT NULL,
  `challenge_id` int NOT NULL,
  `started_at` datetime DEFAULT NULL,
  `completed_at` datetime DEFAULT NULL,
  `points_earned` int NOT NULL DEFAULT '0',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `user_id` (`user_id`),
  KEY `challenge_id` (`challenge_id`),
  CONSTRAINT `user_challenges_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  CONSTRAINT `user_challenges_ibfk_2` FOREIGN KEY (`challenge_id`) REFERENCES `challenges` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `user_challenges`
--

INSERT INTO `user_challenges` (`id`,`user_id`,`challenge_id`,`started_at`,`completed_at`,`points_earned`,`created_at`) VALUES
  (1,2,1,'2025-11-15 12:00:00','2025-11-15 12:30:00',20,'2025-11-15 12:30:00');

--
-- Table structure for table `user_classes`
--

CREATE TABLE `user_classes` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int NOT NULL,
  `class_id` int NOT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `user_id` (`user_id`),
  KEY `class_id` (`class_id`),
  CONSTRAINT `user_classes_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  CONSTRAINT `user_classes_ibfk_2` FOREIGN KEY (`class_id`) REFERENCES `classes` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `user_classes`
--

INSERT INTO `user_classes` VALUES (1,6,1,'2025-11-15 18:26:36');

--
-- Table structure for table `user_day_progress`
--

CREATE TABLE `user_day_progress` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int NOT NULL,
  `day_id` int NOT NULL,
  `status` enum('locked','unlocked','completed') NOT NULL DEFAULT 'locked',
  `started_at` datetime DEFAULT NULL,
  `completed_at` datetime DEFAULT NULL,
  `points_earned` int NOT NULL DEFAULT '0',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uq_day_user` (`user_id`,`day_id`),
  KEY `day_id` (`day_id`),
  CONSTRAINT `user_day_progress_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  CONSTRAINT `user_day_progress_ibfk_2` FOREIGN KEY (`day_id`) REFERENCES `days` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `user_day_progress`
--

INSERT INTO `user_day_progress` (`id`,`user_id`,`day_id`,`status`,`started_at`,`completed_at`,`points_earned`,`created_at`) VALUES
  (1,2,1,'completed','2025-11-15 10:00:00','2025-11-15 11:00:00',25,'2025-11-15 11:00:00'),
  (2,2,2,'unlocked','2025-11-15 11:05:00',NULL,0,'2025-11-15 11:05:00');

--
-- Table structure for table `user_families`
--

CREATE TABLE `user_families` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int NOT NULL,
  `family_id` int NOT NULL,
  `role` enum('parent','teen') NOT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `user_id` (`user_id`),
  KEY `family_id` (`family_id`),
  CONSTRAINT `user_families_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  CONSTRAINT `user_families_ibfk_2` FOREIGN KEY (`family_id`) REFERENCES `families` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `user_families`
--

INSERT INTO `user_families` (`id`,`user_id`,`family_id`,`role`,`created_at`) VALUES
  (1,2,1,'teen','2025-11-15 15:54:03');

--
-- Table structure for table `user_notifications`
--

CREATE TABLE `user_notifications` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int NOT NULL,
  `notification_id` int NOT NULL,
  `delivered_at` datetime NOT NULL,
  `read_at` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `user_id` (`user_id`),
  KEY `notification_id` (`notification_id`),
  CONSTRAINT `user_notifications_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  CONSTRAINT `user_notifications_ibfk_2` FOREIGN KEY (`notification_id`) REFERENCES `notifications` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `user_notifications`
--

INSERT INTO `user_notifications` (`id`,`user_id`,`notification_id`,`delivered_at`,`read_at`) VALUES
  (1,2,1,'2025-11-11 08:01:00','2025-11-11 08:05:00');

--
-- Table structure for table `user_quiz_answers`
--

CREATE TABLE `user_quiz_answers` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int NOT NULL,
  `quiz_id` int NOT NULL,
  `selected_option_id` int DEFAULT NULL,
  `answer_text` text,
  `answer_audio_url` varchar(255) DEFAULT NULL,
  `answer_image_url` varchar(255) DEFAULT NULL,
  `is_correct` tinyint(1) DEFAULT NULL,
  `validation_status` enum('pending','valid','invalid','manual_review') DEFAULT NULL,
  `validation_feedback` text,
  `ai_model` varchar(80) DEFAULT NULL,
  `ai_confidence` decimal(5,3) DEFAULT NULL,
  `ai_response_json` mediumtext,
  `answered_at` datetime NOT NULL,
  `points_earned` int NOT NULL DEFAULT '0',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `user_id` (`user_id`),
  KEY `quiz_id` (`quiz_id`),
  KEY `selected_option_id` (`selected_option_id`),
  CONSTRAINT `user_quiz_answers_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  CONSTRAINT `user_quiz_answers_ibfk_2` FOREIGN KEY (`quiz_id`) REFERENCES `quizzes` (`id`) ON DELETE CASCADE,
  CONSTRAINT `user_quiz_answers_ibfk_3` FOREIGN KEY (`selected_option_id`) REFERENCES `quiz_options` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `user_quiz_answers`
--

INSERT INTO `user_quiz_answers` (`id`,`user_id`,`quiz_id`,`selected_option_id`,`answer_text`,`answer_audio_url`,`answer_image_url`,`is_correct`,`validation_status`,`validation_feedback`,`ai_model`,`ai_confidence`,`ai_response_json`,`answered_at`,`points_earned`,`created_at`) VALUES
  (1,2,1,3,NULL,NULL,NULL,1,'valid',NULL,NULL,NULL,NULL,'2025-11-15 11:10:00',5,'2025-11-15 11:10:00'),
  (2,2,2,5,NULL,NULL,NULL,1,'valid',NULL,NULL,NULL,NULL,'2025-11-15 11:15:00',3,'2025-11-15 11:15:00');

--
-- Table structure for table `user_rewards`
--

CREATE TABLE `user_rewards` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int NOT NULL,
  `reward_id` int NOT NULL,
  `redeemed_at` datetime NOT NULL,
  `voucher_code` varchar(50) NOT NULL,
  `status` enum('pending','delivered','used') NOT NULL DEFAULT 'pending',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `user_id` (`user_id`),
  KEY `reward_id` (`reward_id`),
  CONSTRAINT `user_rewards_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  CONSTRAINT `user_rewards_ibfk_2` FOREIGN KEY (`reward_id`) REFERENCES `rewards` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `user_rewards`
--

INSERT INTO `user_rewards` (`id`,`user_id`,`reward_id`,`redeemed_at`,`voucher_code`,`status`,`created_at`) VALUES
  (1,2,1,'2025-11-15 12:35:00','PSTR-AB12','delivered','2025-11-15 12:35:00');

--
-- Table structure for table `pagseguro_notifications`
--

CREATE TABLE `pagseguro_notifications` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `received_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `notification_code` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
  `notification_type` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
  `ip_address` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `raw_body` mediumtext COLLATE utf8mb4_unicode_ci,
  `http_headers` mediumtext COLLATE utf8mb4_unicode_ci,
  `consulted` tinyint(1) NOT NULL DEFAULT '0',
  `consult_url` varchar(512) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `consult_http_code` int DEFAULT NULL,
  `consult_response` longtext COLLATE utf8mb4_unicode_ci,
  `transaction_code` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `reference` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `status_code` tinyint DEFAULT NULL,
  `status_label` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `gross_amount` decimal(12,2) DEFAULT NULL,
  `paid` tinyint(1) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uq_notification_code` (`notification_code`),
  KEY `idx_notification_received` (`received_at`),
  KEY `idx_notification_type` (`notification_type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;


--
-- Table structure for table `pagseguro_transactions`
--

CREATE TABLE `pagseguro_transactions` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
  `transaction_code` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
  `reference` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `type` tinyint DEFAULT NULL,
  `status_code` tinyint DEFAULT NULL,
  `status_label` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `transaction_date` datetime DEFAULT NULL,
  `last_event_at` datetime DEFAULT NULL,
  `payment_method_type` tinyint DEFAULT NULL,
  `payment_method_code` int DEFAULT NULL,
  `gross_amount` decimal(12,2) DEFAULT NULL,
  `discount_amount` decimal(12,2) DEFAULT NULL,
  `fee_amount` decimal(12,2) DEFAULT NULL,
  `net_amount` decimal(12,2) DEFAULT NULL,
  `extra_amount` decimal(12,2) DEFAULT NULL,
  `installment_count` int DEFAULT NULL,
  `item_count` int DEFAULT NULL,
  `payment_link` varchar(1024) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `payer_name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `payer_email` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `payer_document` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `paid` tinyint(1) DEFAULT NULL,
  `raw_xml` longtext COLLATE utf8mb4_unicode_ci,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uq_transaction_code` (`transaction_code`),
  KEY `idx_transaction_status` (`status_code`),
  KEY `idx_transaction_reference` (`reference`),
  KEY `idx_transaction_email` (`payer_email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci;




