--
-- Host: localhost    Database: laloedata
-- ------------------------------------------------------


--
-- Table structure for table `activity_logs`
--

CREATE TABLE `activity_logs` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int DEFAULT NULL,
  `action` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `entity_type` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `entity_id` int DEFAULT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `details` json DEFAULT NULL,
  `ip_address` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `user_agent` text COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `user_id` (`user_id`),
  KEY `idx_activity_action` (`action`),
  KEY `idx_activity_entity` (`entity_type`,`entity_id`),
  CONSTRAINT `activity_logs_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `activity_logs`
--

INSERT INTO `activity_logs` VALUES (1,4,'create_project','clipmaker_projects',2,'Création projet: Test',NULL,'82.64.1.223',NULL,'2025-07-17 12:05:39'),(2,5,'create_project','clipmaker_projects',3,'Création projet: Tarzan',NULL,'82.64.1.223',NULL,'2025-07-17 14:43:59'),(3,4,'create_user','users',8,'Action admin: create_user sur users','{\"name\": \"Ghislaine\", \"role\": \"user\", \"email\": \"ghislaine.gil@wanadoo.fr\", \"initial_tokens\": \"\"}','82.64.1.223',NULL,'2025-07-29 14:51:17'),(4,4,'update_user','users',0,'Action admin: update_user sur users','{\"name\": \"Ghislaine\", \"role\": \"user\", \"email\": \"ghislaine.gil@wanadoo.fr\", \"status\": null}','82.64.1.223',NULL,'2025-07-29 14:51:17'),(5,4,'create_user','users',9,'Action admin: create_user sur users','{\"name\": \"Abdel\", \"role\": \"user\", \"email\": \"episottevillaise@gmail.com\", \"initial_tokens\": \"\"}','82.64.1.223',NULL,'2025-07-29 14:54:14'),(6,4,'update_user','users',0,'Action admin: update_user sur users','{\"name\": \"Abdel\", \"role\": \"user\", \"email\": \"episottevillaise@gmail.com\", \"status\": null}','82.64.1.223',NULL,'2025-07-29 14:54:14'),(7,4,'delete_user','users',7,'Action admin: delete_user sur users','[]','82.64.1.223',NULL,'2025-07-29 14:54:23');

--
-- Table structure for table `ai_content_templates`
--

CREATE TABLE `ai_content_templates` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int NOT NULL,
  `template_name` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
  `template_category` enum('post_creation','hashtags','optimization','translation','custom') COLLATE utf8mb4_unicode_ci DEFAULT 'post_creation',
  `target_platform` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'instagram, facebook, linkedin, etc.',
  `system_prompt` text COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Template système',
  `user_prompt_template` text COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Template avec variables {topic}, {tone}, etc.',
  `expected_output_format` enum('text','json','markdown','html') COLLATE utf8mb4_unicode_ci DEFAULT 'text',
  `max_tokens` int DEFAULT '500',
  `temperature` decimal(3,2) DEFAULT '0.70',
  `example_input` text COLLATE utf8mb4_unicode_ci COMMENT 'Exemple pour aide utilisateur',
  `example_output` text COLLATE utf8mb4_unicode_ci COMMENT 'Exemple résultat attendu',
  `usage_count` int DEFAULT '0' COMMENT 'Compteur utilisation',
  `is_public` tinyint(1) DEFAULT '0' COMMENT 'Partage communauté',
  `is_premium` tinyint(1) DEFAULT '0' COMMENT 'Template premium',
  `tags` json DEFAULT NULL COMMENT 'Tags pour recherche',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_user_category` (`user_id`,`template_category`),
  KEY `idx_platform` (`target_platform`),
  KEY `idx_public` (`is_public`,`is_premium`),
  KEY `idx_usage` (`usage_count` DESC),
  FULLTEXT KEY `ft_search` (`template_name`,`example_input`),
  CONSTRAINT `fk_ai_templates_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Templates IA personnalisés par utilisateur';

--
-- Dumping data for table `ai_content_templates`
--


--
-- Table structure for table `ai_providers_catalog`
--

CREATE TABLE `ai_providers_catalog` (
  `id` int NOT NULL AUTO_INCREMENT,
  `provider_key` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `provider_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `api_endpoint` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `supported_models` json DEFAULT NULL,
  `pricing_per_1k_tokens` decimal(8,6) DEFAULT '0.000000',
  `free_tier_tokens` int DEFAULT '0',
  `max_tokens_limit` int DEFAULT '4000',
  `supports_streaming` tinyint(1) DEFAULT '0',
  `status` enum('active','maintenance','disabled') COLLATE utf8mb4_unicode_ci DEFAULT 'active',
  `sort_order` int DEFAULT '0',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `provider_key` (`provider_key`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `ai_providers_catalog`
--

INSERT INTO `ai_providers_catalog` VALUES (1,'smg_free','SMG Studio Gratuit','internal','[\"smg-basic\"]',0.000000,50000,2000,0,'active',0,'2025-07-25 12:34:17'),(2,'openai','OpenAI','https://api.openai.com/v1/chat/completions','[\"gpt-3.5-turbo\", \"gpt-4\", \"gpt-4-turbo\", \"gpt-4o\", \"gpt-4o-mini\"]',0.002000,0,8000,1,'active',0,'2025-07-25 12:34:17'),(3,'claude','Anthropic Claude','https://api.anthropic.com/v1/messages','[\"claude-3-haiku\", \"claude-3-sonnet\", \"claude-3-opus\"]',0.001500,0,4000,1,'active',0,'2025-07-25 12:34:17'),(4,'gemini','Google Gemini','https://generativelanguage.googleapis.com/v1beta/models','[\"gemini-pro\", \"gemini-pro-vision\"]',0.001000,15000,4000,0,'active',0,'2025-07-25 12:34:17'),(5,'mistral','Mistral AI','https://api.mistral.ai/v1/chat/completions','[\"mistral-tiny\", \"mistral-small\", \"mistral-medium\"]',0.001200,5000,4000,1,'active',0,'2025-07-25 12:34:17');

--
-- Table structure for table `analytics`
--

CREATE TABLE `analytics` (
  `id` int NOT NULL AUTO_INCREMENT,
  `post_id` int NOT NULL,
  `platform` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `views` int DEFAULT '0',
  `likes` int DEFAULT '0',
  `comments` int DEFAULT '0',
  `shares` int DEFAULT '0',
  `clicks` int DEFAULT '0',
  `impressions` int DEFAULT '0',
  `reach` int DEFAULT '0',
  `engagement_rate` decimal(5,2) DEFAULT '0.00',
  `recorded_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `post_id` (`post_id`),
  CONSTRAINT `analytics_ibfk_1` FOREIGN KEY (`post_id`) REFERENCES `posts` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `analytics`
--


--
-- Table structure for table `assemblage`
--

CREATE TABLE `assemblage` (
  `id` int NOT NULL AUTO_INCREMENT,
  `projet` varchar(100) NOT NULL,
  `ordre_clips` json NOT NULL,
  `clips_json` json NOT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `assemblage`
--


--
-- Table structure for table `audit_trail`
--

CREATE TABLE `audit_trail` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int DEFAULT NULL,
  `table_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `record_id` int NOT NULL,
  `action` enum('INSERT','UPDATE','DELETE') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `old_values` json DEFAULT NULL,
  `new_values` json DEFAULT NULL,
  `ip_address` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `user_agent` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `created_at` datetime DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_audit_user_id` (`user_id`),
  KEY `idx_audit_table_record` (`table_name`,`record_id`),
  KEY `idx_audit_action` (`action`),
  KEY `idx_audit_created_at` (`created_at`),
  CONSTRAINT `audit_trail_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `audit_trail`
--


--
-- Table structure for table `calendrier`
--

CREATE TABLE `calendrier` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int NOT NULL,
  `client_id` int DEFAULT NULL,
  `titre` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `date_prevue` date NOT NULL,
  `heure_prevue` time DEFAULT NULL,
  `reseau` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `statut` enum('planifié','en_cours','terminé','annulé') COLLATE utf8mb4_unicode_ci DEFAULT 'planifié',
  `post_id` int DEFAULT NULL,
  `rappel_sent` tinyint(1) DEFAULT '0',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `post_id` (`post_id`),
  KEY `idx_user_id` (`user_id`),
  KEY `idx_client_id` (`client_id`),
  KEY `idx_date_prevue` (`date_prevue`),
  CONSTRAINT `calendrier_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  CONSTRAINT `calendrier_ibfk_2` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE,
  CONSTRAINT `calendrier_ibfk_3` FOREIGN KEY (`post_id`) REFERENCES `posts` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `calendrier`
--


--
-- Table structure for table `campaigns`
--

CREATE TABLE `campaigns` (
  `id` int NOT NULL AUTO_INCREMENT,
  `project_id` int NOT NULL,
  `user_id` int NOT NULL,
  `nom` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `objectif` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `budget` decimal(10,2) DEFAULT NULL,
  `currency` varchar(3) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT 'EUR',
  `start_date` date DEFAULT NULL,
  `end_date` date DEFAULT NULL,
  `status` enum('draft','active','paused','completed','cancelled') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT 'draft',
  `platforms` json DEFAULT NULL,
  `target_audience` json DEFAULT NULL,
  `kpis` json DEFAULT NULL,
  `settings` json DEFAULT NULL,
  `created_at` datetime DEFAULT CURRENT_TIMESTAMP,
  `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_campaigns_project_id` (`project_id`),
  KEY `idx_campaigns_user_id` (`user_id`),
  KEY `idx_campaigns_status` (`status`),
  KEY `idx_campaigns_start_date` (`start_date`),
  CONSTRAINT `campaigns_ibfk_1` FOREIGN KEY (`project_id`) REFERENCES `projects` (`id`) ON DELETE CASCADE,
  CONSTRAINT `campaigns_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `campaigns`
--


--
-- Table structure for table `clients`
--

CREATE TABLE `clients` (
  `id` int NOT NULL AUTO_INCREMENT,
  `nom` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `telephone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `adresse` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `ville` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `code_postal` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `pays` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT 'France',
  `logo_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `site_web` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `secteur_activite` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `notes` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `description` text COLLATE utf8mb4_unicode_ci,
  `status` enum('active','inactive','prospect','deleted') COLLATE utf8mb4_unicode_ci DEFAULT 'active',
  `created_by` int NOT NULL,
  `created_at` datetime DEFAULT CURRENT_TIMESTAMP,
  `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `deleted_at` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_clients_created_by` (`created_by`),
  KEY `idx_clients_status` (`status`),
  KEY `idx_clients_nom` (`nom`),
  KEY `idx_clients_email` (`email`),
  KEY `idx_clients_secteur` (`secteur_activite`),
  CONSTRAINT `clients_ibfk_1` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `clients`
--


--
-- Table structure for table `clip_sequences`
--

CREATE TABLE `clip_sequences` (
  `id` int NOT NULL AUTO_INCREMENT,
  `clip_id` int DEFAULT NULL,
  `video_prefix` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `sequence_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `file_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `thumb_start` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `thumb_end` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `preview_gif` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `start_time` double DEFAULT NULL,
  `end_time` double DEFAULT NULL,
  `duration` double DEFAULT NULL,
  `created_at` datetime DEFAULT NULL,
  `transition` int DEFAULT NULL,
  `plan_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `sequence_order` int DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `clip_id` (`clip_id`),
  KEY `idx_sequence_order` (`sequence_order`),
  CONSTRAINT `clip_sequences_ibfk_1` FOREIGN KEY (`clip_id`) REFERENCES `clips_projets` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `clip_sequences`
--

INSERT INTO `clip_sequences` VALUES (15,NULL,'R_TOT','R_TOT_SEQ_001','/social-media-generator/uploads/clipmaker/sequences/R_TOT_SEQ_001.mp4',NULL,NULL,'/social-media-generator/uploads/clipmaker/sequences/preview_15_1752877789.gif',3.749166,6.128125,2.378959,'2025-07-18 22:29:49',NULL,'',1),(16,NULL,'R_TOT','R_TOT_SEQ_001','/social-media-generator/uploads/clipmaker/sequences/R_TOT_SEQ_001.mp4',NULL,NULL,NULL,1.532083,3.545687,2.014,'2025-07-18 22:35:07',NULL,'',2),(17,NULL,'R_TOT','R_TOT_SEQ_001','/social-media-generator/uploads/clipmaker/sequences/R_TOT_SEQ_001.mp4',NULL,NULL,'/social-media-generator/uploads/clipmaker/sequences/preview_17_1752878282.gif',4.716,23.974,19.258,'2025-07-18 22:38:02',NULL,'',3),(18,NULL,'R_MAR','R_MAR_SEQ_001','/social-media-generator/uploads/clipmaker/sequences/R_MAR_SEQ_001.mp4',NULL,NULL,'/social-media-generator/uploads/clipmaker/sequences/preview_18_1752910060.gif',7.486,10.696,3.21,'2025-07-19 07:27:39',NULL,'',2),(20,NULL,'R_MAR','R_MAR_SEQ_001','/social-media-generator/uploads/clipmaker/sequences/R_MAR_SEQ_001.mp4',NULL,NULL,'/social-media-generator/uploads/clipmaker/sequences/preview_20_1752915226.gif',27.412,38.22,10.808,'2025-07-19 08:53:46',31,'',1);

--
-- Table structure for table `clipmaker_ai_logs`
--

CREATE TABLE `clipmaker_ai_logs` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int NOT NULL,
  `project_id` int DEFAULT NULL,
  `media_id` int DEFAULT NULL,
  `ai_type` enum('subtitles','tts','color_correction','scene_detection','object_detection') COLLATE utf8mb4_unicode_ci NOT NULL,
  `input_data` json DEFAULT NULL COMMENT 'Données d''entrée',
  `output_data` json DEFAULT NULL COMMENT 'Résultat IA',
  `provider` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'OpenAI, Azure, Google, etc.',
  `model_used` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Modèle IA utilisé',
  `processing_time` float DEFAULT NULL COMMENT 'Temps de traitement en secondes',
  `tokens_used` int DEFAULT NULL COMMENT 'Tokens consommés',
  `cost` decimal(10,4) DEFAULT NULL COMMENT 'Coût en euros',
  `status` enum('success','failed','partial') COLLATE utf8mb4_unicode_ci DEFAULT 'success',
  `error_message` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_user_id` (`user_id`),
  KEY `idx_project_id` (`project_id`),
  KEY `idx_media_id` (`media_id`),
  KEY `idx_ai_type` (`ai_type`),
  KEY `idx_created_at` (`created_at`),
  CONSTRAINT `clipmaker_ai_logs_media_fk` FOREIGN KEY (`media_id`) REFERENCES `clipmaker_media` (`id`) ON DELETE CASCADE,
  CONSTRAINT `clipmaker_ai_logs_project_fk` FOREIGN KEY (`project_id`) REFERENCES `clipmaker_projects` (`id`) ON DELETE CASCADE,
  CONSTRAINT `clipmaker_ai_logs_user_fk` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Logs actions IA Clipmaker';

--
-- Dumping data for table `clipmaker_ai_logs`
--


--
-- Table structure for table `clipmaker_clip_transitions`
--

CREATE TABLE `clipmaker_clip_transitions` (
  `id` int NOT NULL AUTO_INCREMENT,
  `project_id` int NOT NULL,
  `clip_from_id` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'ID du clip source dans timeline_data',
  `clip_to_id` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'ID du clip destination dans timeline_data',
  `transition_id` int NOT NULL COMMENT 'Référence vers ta table transitions',
  `duration` float DEFAULT '1' COMMENT 'Durée de la transition en secondes',
  `position` float DEFAULT NULL COMMENT 'Position dans la timeline',
  `parameters` json DEFAULT NULL COMMENT 'Paramètres spécifiques de la transition',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_project_id` (`project_id`),
  KEY `idx_transition_id` (`transition_id`),
  KEY `idx_clips` (`clip_from_id`,`clip_to_id`),
  CONSTRAINT `clipmaker_clip_transitions_project_fk` FOREIGN KEY (`project_id`) REFERENCES `clipmaker_projects` (`id`) ON DELETE CASCADE,
  CONSTRAINT `clipmaker_clip_transitions_transition_fk` FOREIGN KEY (`transition_id`) REFERENCES `transitions` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Transitions entre clips Clipmaker';

--
-- Dumping data for table `clipmaker_clip_transitions`
--


--
-- Table structure for table `clipmaker_clips`
--

CREATE TABLE `clipmaker_clips` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int NOT NULL,
  `project_id` int DEFAULT NULL,
  `media_id` int DEFAULT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `start_time` decimal(10,3) DEFAULT '0.000',
  `duration` decimal(10,3) DEFAULT '0.000',
  `track_type` enum('video','audio') COLLATE utf8mb4_unicode_ci DEFAULT 'video',
  `in_point` decimal(10,3) DEFAULT '0.000',
  `out_point` decimal(10,3) DEFAULT '0.000',
  `position_order` int DEFAULT '0',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_user_project` (`user_id`,`project_id`),
  KEY `idx_position` (`position_order`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `clipmaker_clips`
--


--
-- Table structure for table `clipmaker_exports`
--

CREATE TABLE `clipmaker_exports` (
  `id` int NOT NULL AUTO_INCREMENT,
  `project_id` int NOT NULL,
  `user_id` int NOT NULL,
  `export_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `format` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'mp4, webm, mov, gif',
  `quality` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'high, medium, low',
  `resolution` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '1920x1080, 1080x1080, etc.',
  `file_path` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `file_size` bigint DEFAULT NULL,
  `export_settings` json DEFAULT NULL COMMENT 'Paramètres FFmpeg utilisés',
  `status` enum('pending','processing','completed','failed','cancelled') COLLATE utf8mb4_unicode_ci DEFAULT 'pending',
  `progress` int DEFAULT '0' COMMENT 'Progression 0-100%',
  `estimated_time` int DEFAULT NULL COMMENT 'Temps restant estimé en secondes',
  `error_message` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `ffmpeg_command` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT 'Commande FFmpeg exécutée',
  `processing_log` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `download_count` int DEFAULT '0',
  `started_at` timestamp NULL DEFAULT NULL,
  `completed_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_project_id` (`project_id`),
  KEY `idx_user_id` (`user_id`),
  KEY `idx_status` (`status`),
  KEY `idx_created_at` (`created_at`),
  KEY `idx_exports_user_status` (`user_id`,`status`),
  CONSTRAINT `clipmaker_exports_project_fk` FOREIGN KEY (`project_id`) REFERENCES `clipmaker_projects` (`id`) ON DELETE CASCADE,
  CONSTRAINT `clipmaker_exports_user_fk` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Exports vidéo Clipmaker';

--
-- Dumping data for table `clipmaker_exports`
--

INSERT INTO `clipmaker_exports` VALUES (1,1,4,'Project_1_2025-07-19_09-02-04','mp4','medium','1920x1080','/social-media-generator/uploads/clipmaker/exports/Project_1_2025-07-19_09-02-04.mp4',4550291,'{\"format\": \"mp4\", \"quality\": \"medium\", \"resolution\": \"1920x1080\"}','completed',0,NULL,NULL,'ffmpeg -i \'/var/www/laloee-cours.fr/social-media-generator/uploads/clipmaker/sequences/R_MAR_SEQ_001.mp4\' -i \'/var/www/laloee-cours.fr/social-media-generator/uploads/clipmaker/sequences/R_MAR_SEQ_001.mp4\' -filter_complex \"[0:v][0:a][1:v][1:a]concat=n=2:v=1:a=1[outv][outa]\" -map \"[outv]\" -map \"[outa]\" -c:v libx264 -preset medium -crf 23 -c:a aac -b:a 128k -movflags +faststart -y \'/var/www/laloee-cours.fr/social-media-generator/uploads/clipmaker/exports/Project_1_2025-07-19_09-02-04.mp4\' 2>&1','ffmpeg version 7.1.1-1ubuntu1.1 Copyright (c) 2000-2025 the FFmpeg developers\n  built with gcc 14 (Ubuntu 14.2.0-19ubuntu2)\n  configuration: --prefix=/usr --extra-version=1ubuntu1.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --disable-libmfx --disable-omx --enable-gnutls --enable-libaom --enable-libass --enable-libbs2b --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libharfbuzz --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-openal --enable-opencl --enable-opengl --disable-sndio --enable-libvpl --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-ladspa --enable-libbluray --enable-libcaca --enable-libdvdnav --enable-libdvdread --enable-libjack --enable-libpulse --enable-librabbitmq --enable-librist --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libx264 --enable-libzmq --enable-libzvbi --enable-lv2 --enable-sdl2 --enable-libplacebo --enable-librav1e --enable-pocketsphinx --enable-librsvg --enable-libjxl --enable-shared\n  libavutil      59. 39.100 / 59. 39.100\n  libavcodec     61. 19.101 / 61. 19.101\n  libavformat    61.  7.100 / 61.  7.100\n  libavdevice    61.  3.100 / 61.  3.100\n  libavfilter    10.  4.100 / 10.  4.100\n  libswscale      8.  3.100 /  8.  3.100\n  libswresample   5.  3.100 /  5.  3.100\n  libpostproc    58.  3.100 / 58.  3.100\nInput #0, mov,mp4,m4a,3gp,3g2,mj2, from \'/var/www/laloee-cours.fr/social-media-generator/uploads/clipmaker/sequences/R_MAR_SEQ_001.mp4\':\n  Metadata:\n    major_brand     : isom\n    minor_version   : 512\n    compatible_brands: isomiso2avc1mp41\n    title           : rouen-max\n    artist          : audiovizu\n    date            : 2023-02-05\n    encoder         : Lavf61.7.100\n    copyright       : audiovizu\n  Duration: 00:00:11.08, start: 0.000000, bitrate: 1767 kb/s\n  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 1192x668 [SAR 1:1 DAR 298:167], 1858 kb/s, 8 fps, 8 tbr, 16384 tbn (default)\n      Metadata:\n        handler_name    : VideoHandler\n        vendor_id       : [0][0][0][0]\n        encoder         : Lavc61.19.101 libx264\n  Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 2 kb/s (default)\n      Metadata:\n        handler_name    : SoundHandler\n        vendor_id       : [0][0][0][0]\nInput #1, mov,mp4,m4a,3gp,3g2,mj2, from \'/var/www/laloee-cours.fr/social-media-generator/uploads/clipmaker/sequences/R_MAR_SEQ_001.mp4\':\n  Metadata:\n    major_brand     : isom\n    minor_version   : 512\n    compatible_brands: isomiso2avc1mp41\n    title           : rouen-max\n    artist          : audiovizu\n    date            : 2023-02-05\n    encoder         : Lavf61.7.100\n    copyright       : audiovizu\n  Duration: 00:00:11.08, start: 0.000000, bitrate: 1767 kb/s\n  Stream #1:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 1192x668 [SAR 1:1 DAR 298:167], 1858 kb/s, 8 fps, 8 tbr, 16384 tbn (default)\n      Metadata:\n        handler_name    : VideoHandler\n        vendor_id       : [0][0][0][0]\n        encoder         : Lavc61.19.101 libx264\n  Stream #1:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 2 kb/s (default)\n      Metadata:\n        handler_name    : SoundHandler\n        vendor_id       : [0][0][0][0]\nStream mapping:\n  Stream #0:0 (h264) -> concat\n  Stream #0:1 (aac) -> concat\n  Stream #1:0 (h264) -> concat\n  Stream #1:1 (aac) -> concat\n  concat -> Stream #0:0 (libx264)\n  concat -> Stream #0:1 (aac)\nPress [q] to stop, [?] for help\n[libx264 @ 0x5b50599d7a00] using SAR=1/1\n[libx264 @ 0x5b50599d7a00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2\n[libx264 @ 0x5b50599d7a00] profile High, level 3.1, 4:2:0, 8-bit\n[libx264 @ 0x5b50599d7a00] 264 - core 164 r3108 31e19f9 - H.264/MPEG-4 AVC codec - Copyleft 2003-2023 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=3 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=8 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00\nOutput #0, mp4, to \'/var/www/laloee-cours.fr/social-media-generator/uploads/clipmaker/exports/Project_1_2025-07-19_09-02-04.mp4\':\n  Metadata:\n    major_brand     : isom\n    minor_version   : 512\n    compatible_brands: isomiso2avc1mp41\n    title           : rouen-max\n    artist          : audiovizu\n    date            : 2023-02-05\n    copyright       : audiovizu\n    encoder         : Lavf61.7.100\n  Stream #0:0: Video: h264 (avc1 / 0x31637661), yuv420p(tv, progressive), 1192x668 [SAR 1:1 DAR 298:167], q=2-31, 8 fps, 16384 tbn\n      Metadata:\n        encoder         : Lavc61.19.101 libx264\n      Side data:\n        cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A\n  Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s\n      Metadata:\n        encoder         : Lavc61.19.101 aac\nframe=    0 fps=0.0 q=0.0 size=       0KiB time=N/A bitrate=N/A speed=N/A    \rframe=   10 fps= 10 q=24.0 size=       0KiB time=00:00:01.62 bitrate=   0.2kbits/s speed=1.62x    \rframe=   22 fps= 15 q=24.0 size=     512KiB time=00:00:03.12 bitrate=1342.3kbits/s speed=2.08x    \r[out_#0:1 @ 0x73cb18019100] 100 buffers queued in out_#0:1, something may be wrong.\nframe=   37 fps= 18 q=24.0 size=     512KiB time=00:00:05.00 bitrate= 838.9kbits/s speed= 2.5x    \rframe=   50 fps= 20 q=24.0 size=    1024KiB time=00:00:06.62 bitrate=1266.3kbits/s speed=2.65x    \rframe=   62 fps= 21 q=24.0 size=    1536KiB time=00:00:08.12 bitrate=1548.7kbits/s speed=2.71x    \rframe=   76 fps= 22 q=24.0 size=    1792KiB time=00:00:09.87 bitrate=1486.6kbits/s speed=2.82x    \rframe=   87 fps= 22 q=24.0 size=    2304KiB time=00:00:11.75 bitrate=1606.4kbits/s speed=2.94x    \rframe=  103 fps= 23 q=24.0 size=    2560KiB time=00:00:13.75 bitrate=1525.2kbits/s speed=3.05x    \rframe=  116 fps= 23 q=24.0 size=    2816KiB time=N/A bitrate=N/A speed=N/A    \rframe=  131 fps= 24 q=24.0 size=    3072KiB time=N/A bitrate=N/A speed=N/A    \rframe=  147 fps= 24 q=24.0 size=    3584KiB time=N/A bitrate=N/A speed=N/A    \rframe=  166 fps= 26 q=24.0 size=    4096KiB time=N/A bitrate=N/A speed=N/A    \r[mp4 @ 0x5b50599d5ac0] Starting second pass: moving the moov atom to the beginning of the file\n[out#0/mp4 @ 0x5b50599cf7c0] video:4428KiB audio:6KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: 0.207604%\nframe=  168 fps= 26 q=-1.0 Lsize=    4444KiB time=00:00:21.87 bitrate=1664.1kbits/s speed=3.35x\n[libx264 @ 0x5b50599d7a00] frame I:9     Avg QP:18.66  size: 84688\n[libx264 @ 0x5b50599d7a00] frame P:69    Avg QP:21.59  size: 37398\n[libx264 @ 0x5b50599d7a00] frame B:90    Avg QP:24.61  size: 13236\n[libx264 @ 0x5b50599d7a00] consecutive B-frames: 22.6% 11.9% 17.9% 47.6%\n[libx264 @ 0x5b50599d7a00] mb I  I16..4: 24.5% 52.0% 23.5%\n[libx264 @ 0x5b50599d7a00] mb P  I16..4:  5.3% 21.6%  6.2%  P16..4: 18.9% 17.2% 17.2%  0.0%  0.0%    skip:13.5%\n[libx264 @ 0x5b50599d7a00] mb B  I16..4:  1.1%  3.4%  1.8%  B16..8: 31.0% 12.2%  5.7%  direct: 2.1%  skip:42.8%  L0:47.6% L1:42.4% BI: 9.9%\n[libx264 @ 0x5b50599d7a00] 8x8 transform intra:60.4% inter:66.1%\n[libx264 @ 0x5b50599d7a00] coded y,uvDC,uvAC intra: 53.0% 35.9% 10.0% inter: 24.9% 13.3% 0.3%\n[libx264 @ 0x5b50599d7a00] i16 v,h,dc,p: 46% 34%  6% 13%\n[libx264 @ 0x5b50599d7a00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 37% 27% 14%  3%  4%  4%  4%  4%  4%\n[libx264 @ 0x5b50599d7a00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 26% 32% 10%  4%  6%  6%  6%  5%  5%\n[libx264 @ 0x5b50599d7a00] i8c dc,h,v,p: 62% 20% 16%  3%\n[libx264 @ 0x5b50599d7a00] Weighted P-Frames: Y:0.0% UV:0.0%\n[libx264 @ 0x5b50599d7a00] ref P L0: 72.1% 14.4%  5.9%  7.7%\n[libx264 @ 0x5b50599d7a00] ref B L0: 92.5%  4.5%  3.1%\n[libx264 @ 0x5b50599d7a00] ref B L1: 96.5%  3.5%\n[libx264 @ 0x5b50599d7a00] kb/s:1687.04\n[aac @ 0x5b50599b9180] Qavg: 65536.000',0,NULL,'2025-07-19 09:02:11','2025-07-19 09:02:04');

--
-- Table structure for table `clipmaker_logs`
--

CREATE TABLE `clipmaker_logs` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int NOT NULL,
  `action` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `details` text COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_user_date` (`user_id`,`created_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `clipmaker_logs`
--


--
-- Table structure for table `clipmaker_media`
--

CREATE TABLE `clipmaker_media` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int NOT NULL,
  `project_id` int DEFAULT NULL COMMENT 'Média lié à un projet spécifique',
  `original_filename` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `stored_filename` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `file_path` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `file_type` enum('video','image','audio','text') COLLATE utf8mb4_unicode_ci NOT NULL,
  `mime_type` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `file_size` bigint NOT NULL,
  `width` int DEFAULT NULL,
  `height` int DEFAULT NULL,
  `duration` float DEFAULT NULL COMMENT 'Durée en secondes pour vidéo/audio',
  `thumbnail_path` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `waveform_path` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `metadata` json DEFAULT NULL COMMENT 'Métadonnées FFprobe',
  `conversion_status` enum('pending','processing','completed','failed') COLLATE utf8mb4_unicode_ci DEFAULT 'completed',
  `conversion_log` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `ai_analysis` json DEFAULT NULL COMMENT 'Analyse IA (sous-titres, etc.)',
  `tags` json DEFAULT NULL COMMENT 'Tags utilisateur',
  `is_public` tinyint(1) DEFAULT '0' COMMENT 'Partageable entre projets',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_user_id` (`user_id`),
  KEY `idx_project_id` (`project_id`),
  KEY `idx_file_type` (`file_type`),
  KEY `idx_conversion_status` (`conversion_status`),
  KEY `idx_created_at` (`created_at`),
  KEY `idx_media_user_type` (`user_id`,`file_type`),
  KEY `idx_clipmaker_file_paths` (`file_path`(100)),
  KEY `idx_clipmaker_thumbnails` (`thumbnail_path`(100)),
  CONSTRAINT `clipmaker_media_project_fk` FOREIGN KEY (`project_id`) REFERENCES `clipmaker_projects` (`id`) ON DELETE SET NULL,
  CONSTRAINT `clipmaker_media_user_fk` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Bibliothèque médias Clipmaker';

--
-- Dumping data for table `clipmaker_media`
--

INSERT INTO `clipmaker_media` VALUES (2,4,NULL,'R_PRO001.mp4','R_PRO001_1752908864.mp4','/social-media-generator/uploads/clipmaker/media/R_PRO001_1752908864.mp4','video','video/mp4',11228679,1192,668,51.52,NULL,NULL,'{\"format\": {\"size\": \"11228679\", \"tags\": {\"date\": \"2023-02-05\", \"title\": \"rouen-max\", \"artist\": \"audiovizu\", \"encoder\": \"Lavf61.7.100\", \"copyright\": \"audiovizu\", \"major_brand\": \"isom\", \"minor_version\": \"512\", \"compatible_brands\": \"isomiso2avc1mp41\"}, \"bit_rate\": \"1743583\", \"duration\": \"51.520000\", \"filename\": \"/var/www/laloee-cours.fr/social-media-generator/uploads/clipmaker/media/R_PRO001_1752908864.mp4\", \"nb_streams\": 2, \"start_time\": \"0.000000\", \"format_name\": \"mov,mp4,m4a,3gp,3g2,mj2\", \"nb_programs\": 0, \"probe_score\": 100, \"format_long_name\": \"QuickTime / MOV\", \"nb_stream_groups\": 0}, \"streams\": [{\"id\": \"0x1\", \"refs\": 1, \"tags\": {\"encoder\": \"Lavc61.19.101 libx264\", \"language\": \"und\", \"vendor_id\": \"[0][0][0][0]\", \"handler_name\": \"VideoHandler\"}, \"index\": 0, \"level\": 31, \"width\": 1192, \"height\": 668, \"is_avc\": \"true\", \"pix_fmt\": \"yuv420p\", \"profile\": \"High\", \"bit_rate\": \"1738836\", \"duration\": \"51.500000\", \"codec_tag\": \"0x31637661\", \"nb_frames\": \"412\", \"start_pts\": 0, \"time_base\": \"1/16384\", \"codec_name\": \"h264\", \"codec_type\": \"video\", \"film_grain\": 0, \"start_time\": \"0.000000\", \"coded_width\": 1192, \"disposition\": {\"dub\": 0, \"forced\": 0, \"lyrics\": 0, \"comment\": 0, \"default\": 1, \"karaoke\": 0, \"captions\": 0, \"metadata\": 0, \"original\": 0, \"dependent\": 0, \"multilayer\": 0, \"still_image\": 0, \"attached_pic\": 0, \"descriptions\": 0, \"non_diegetic\": 0, \"clean_effects\": 0, \"visual_impaired\": 0, \"hearing_impaired\": 0, \"timed_thumbnails\": 0}, \"duration_ts\": 843776, \"field_order\": \"progressive\", \"coded_height\": 668, \"has_b_frames\": 2, \"r_frame_rate\": \"8/1\", \"avg_frame_rate\": \"8/1\", \"extradata_size\": 48, \"chroma_location\": \"left\", \"closed_captions\": 0, \"codec_long_name\": \"H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10\", \"nal_length_size\": \"4\", \"codec_tag_string\": \"avc1\", \"bits_per_raw_sample\": \"8\", \"sample_aspect_ratio\": \"1:1\", \"display_aspect_ratio\": \"298:167\"}, {\"id\": \"0x2\", \"tags\": {\"language\": \"und\", \"vendor_id\": \"[0][0][0][0]\", \"handler_name\": \"SoundHandler\"}, \"index\": 1, \"profile\": \"LC\", \"bit_rate\": \"2276\", \"channels\": 2, \"duration\": \"51.520000\", \"codec_tag\": \"0x6134706d\", \"nb_frames\": \"2416\", \"start_pts\": 0, \"time_base\": \"1/48000\", \"codec_name\": \"aac\", \"codec_type\": \"audio\", \"sample_fmt\": \"fltp\", \"start_time\": \"0.000000\", \"disposition\": {\"dub\": 0, \"forced\": 0, \"lyrics\": 0, \"comment\": 0, \"default\": 1, \"karaoke\": 0, \"captions\": 0, \"metadata\": 0, \"original\": 0, \"dependent\": 0, \"multilayer\": 0, \"still_image\": 0, \"attached_pic\": 0, \"descriptions\": 0, \"non_diegetic\": 0, \"clean_effects\": 0, \"visual_impaired\": 0, \"hearing_impaired\": 0, \"timed_thumbnails\": 0}, \"duration_ts\": 2472960, \"sample_rate\": \"48000\", \"r_frame_rate\": \"0/0\", \"avg_frame_rate\": \"0/0\", \"channel_layout\": \"stereo\", \"extradata_size\": 5, \"bits_per_sample\": 0, \"codec_long_name\": \"AAC (Advanced Audio Coding)\", \"initial_padding\": 0, \"codec_tag_string\": \"mp4a\"}]}','completed',NULL,NULL,NULL,0,'2025-07-19 07:07:44','2025-07-19 07:08:00'),(4,4,1,'R_MAR001.mp4','R_MAR001_1752909828.mp4','/social-media-generator/uploads/clipmaker/media/R_MAR001_1752909828.mp4','video','video/mp4',11228679,1192,668,51.52,NULL,NULL,'{\"format\": {\"size\": \"11228679\", \"tags\": {\"date\": \"2023-02-05\", \"title\": \"rouen-max\", \"artist\": \"audiovizu\", \"encoder\": \"Lavf61.7.100\", \"copyright\": \"audiovizu\", \"major_brand\": \"isom\", \"minor_version\": \"512\", \"compatible_brands\": \"isomiso2avc1mp41\"}, \"bit_rate\": \"1743583\", \"duration\": \"51.520000\", \"filename\": \"/var/www/laloee-cours.fr/social-media-generator/uploads/clipmaker/media/R_MAR001_1752909828.mp4\", \"nb_streams\": 2, \"start_time\": \"0.000000\", \"format_name\": \"mov,mp4,m4a,3gp,3g2,mj2\", \"nb_programs\": 0, \"probe_score\": 100, \"format_long_name\": \"QuickTime / MOV\", \"nb_stream_groups\": 0}, \"streams\": [{\"id\": \"0x1\", \"refs\": 1, \"tags\": {\"encoder\": \"Lavc61.19.101 libx264\", \"language\": \"und\", \"vendor_id\": \"[0][0][0][0]\", \"handler_name\": \"VideoHandler\"}, \"index\": 0, \"level\": 31, \"width\": 1192, \"height\": 668, \"is_avc\": \"true\", \"pix_fmt\": \"yuv420p\", \"profile\": \"High\", \"bit_rate\": \"1738836\", \"duration\": \"51.500000\", \"codec_tag\": \"0x31637661\", \"nb_frames\": \"412\", \"start_pts\": 0, \"time_base\": \"1/16384\", \"codec_name\": \"h264\", \"codec_type\": \"video\", \"film_grain\": 0, \"start_time\": \"0.000000\", \"coded_width\": 1192, \"disposition\": {\"dub\": 0, \"forced\": 0, \"lyrics\": 0, \"comment\": 0, \"default\": 1, \"karaoke\": 0, \"captions\": 0, \"metadata\": 0, \"original\": 0, \"dependent\": 0, \"multilayer\": 0, \"still_image\": 0, \"attached_pic\": 0, \"descriptions\": 0, \"non_diegetic\": 0, \"clean_effects\": 0, \"visual_impaired\": 0, \"hearing_impaired\": 0, \"timed_thumbnails\": 0}, \"duration_ts\": 843776, \"field_order\": \"progressive\", \"coded_height\": 668, \"has_b_frames\": 2, \"r_frame_rate\": \"8/1\", \"avg_frame_rate\": \"8/1\", \"extradata_size\": 48, \"chroma_location\": \"left\", \"closed_captions\": 0, \"codec_long_name\": \"H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10\", \"nal_length_size\": \"4\", \"codec_tag_string\": \"avc1\", \"bits_per_raw_sample\": \"8\", \"sample_aspect_ratio\": \"1:1\", \"display_aspect_ratio\": \"298:167\"}, {\"id\": \"0x2\", \"tags\": {\"language\": \"und\", \"vendor_id\": \"[0][0][0][0]\", \"handler_name\": \"SoundHandler\"}, \"index\": 1, \"profile\": \"LC\", \"bit_rate\": \"2276\", \"channels\": 2, \"duration\": \"51.520000\", \"codec_tag\": \"0x6134706d\", \"nb_frames\": \"2416\", \"start_pts\": 0, \"time_base\": \"1/48000\", \"codec_name\": \"aac\", \"codec_type\": \"audio\", \"sample_fmt\": \"fltp\", \"start_time\": \"0.000000\", \"disposition\": {\"dub\": 0, \"forced\": 0, \"lyrics\": 0, \"comment\": 0, \"default\": 1, \"karaoke\": 0, \"captions\": 0, \"metadata\": 0, \"original\": 0, \"dependent\": 0, \"multilayer\": 0, \"still_image\": 0, \"attached_pic\": 0, \"descriptions\": 0, \"non_diegetic\": 0, \"clean_effects\": 0, \"visual_impaired\": 0, \"hearing_impaired\": 0, \"timed_thumbnails\": 0}, \"duration_ts\": 2472960, \"sample_rate\": \"48000\", \"r_frame_rate\": \"0/0\", \"avg_frame_rate\": \"0/0\", \"channel_layout\": \"stereo\", \"extradata_size\": 5, \"bits_per_sample\": 0, \"codec_long_name\": \"AAC (Advanced Audio Coding)\", \"initial_padding\": 0, \"codec_tag_string\": \"mp4a\"}]}','completed',NULL,NULL,NULL,0,'2025-07-19 07:23:48','2025-07-19 07:24:04'),(5,4,NULL,'rouen-max.webm','media_1752936709_687bb1058bca0.webm','/social-media-generator/uploads/clipmaker/media/media_1752936709_687bb1058bca0.webm','video','video/webm',8706588,NULL,NULL,NULL,NULL,NULL,NULL,'completed',NULL,NULL,NULL,0,'2025-07-19 14:51:49','2025-07-19 14:51:49'),(6,4,NULL,'rouen-max.webm','media_1752998027_687ca08b2c834.webm','/social-media-generator/uploads/clipmaker/media/media_1752998027_687ca08b2c834.webm','video','video/webm',8706588,NULL,NULL,NULL,NULL,NULL,NULL,'completed',NULL,NULL,NULL,0,'2025-07-20 07:53:47','2025-07-20 07:53:47'),(7,4,NULL,'R_PRO001.mp4','R_PRO001_1752998171.mp4','/social-media-generator/uploads/clipmaker/media/R_PRO001_1752998171.mp4','video','video/mp4',11228679,1192,668,51.52,NULL,NULL,'{\"format\": {\"size\": \"11228679\", \"tags\": {\"date\": \"2023-02-05\", \"title\": \"rouen-max\", \"artist\": \"audiovizu\", \"encoder\": \"Lavf61.7.100\", \"copyright\": \"audiovizu\", \"major_brand\": \"isom\", \"minor_version\": \"512\", \"compatible_brands\": \"isomiso2avc1mp41\"}, \"bit_rate\": \"1743583\", \"duration\": \"51.520000\", \"filename\": \"/var/www/laloee-cours.fr/social-media-generator/uploads/clipmaker/media/R_PRO001_1752998171.mp4\", \"nb_streams\": 2, \"start_time\": \"0.000000\", \"format_name\": \"mov,mp4,m4a,3gp,3g2,mj2\", \"nb_programs\": 0, \"probe_score\": 100, \"format_long_name\": \"QuickTime / MOV\", \"nb_stream_groups\": 0}, \"streams\": [{\"id\": \"0x1\", \"refs\": 1, \"tags\": {\"encoder\": \"Lavc61.19.101 libx264\", \"language\": \"und\", \"vendor_id\": \"[0][0][0][0]\", \"handler_name\": \"VideoHandler\"}, \"index\": 0, \"level\": 31, \"width\": 1192, \"height\": 668, \"is_avc\": \"true\", \"pix_fmt\": \"yuv420p\", \"profile\": \"High\", \"bit_rate\": \"1738836\", \"duration\": \"51.500000\", \"codec_tag\": \"0x31637661\", \"nb_frames\": \"412\", \"start_pts\": 0, \"time_base\": \"1/16384\", \"codec_name\": \"h264\", \"codec_type\": \"video\", \"film_grain\": 0, \"start_time\": \"0.000000\", \"coded_width\": 1192, \"disposition\": {\"dub\": 0, \"forced\": 0, \"lyrics\": 0, \"comment\": 0, \"default\": 1, \"karaoke\": 0, \"captions\": 0, \"metadata\": 0, \"original\": 0, \"dependent\": 0, \"multilayer\": 0, \"still_image\": 0, \"attached_pic\": 0, \"descriptions\": 0, \"non_diegetic\": 0, \"clean_effects\": 0, \"visual_impaired\": 0, \"hearing_impaired\": 0, \"timed_thumbnails\": 0}, \"duration_ts\": 843776, \"field_order\": \"progressive\", \"coded_height\": 668, \"has_b_frames\": 2, \"r_frame_rate\": \"8/1\", \"avg_frame_rate\": \"8/1\", \"extradata_size\": 48, \"chroma_location\": \"left\", \"closed_captions\": 0, \"codec_long_name\": \"H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10\", \"nal_length_size\": \"4\", \"codec_tag_string\": \"avc1\", \"bits_per_raw_sample\": \"8\", \"sample_aspect_ratio\": \"1:1\", \"display_aspect_ratio\": \"298:167\"}, {\"id\": \"0x2\", \"tags\": {\"language\": \"und\", \"vendor_id\": \"[0][0][0][0]\", \"handler_name\": \"SoundHandler\"}, \"index\": 1, \"profile\": \"LC\", \"bit_rate\": \"2276\", \"channels\": 2, \"duration\": \"51.520000\", \"codec_tag\": \"0x6134706d\", \"nb_frames\": \"2416\", \"start_pts\": 0, \"time_base\": \"1/48000\", \"codec_name\": \"aac\", \"codec_type\": \"audio\", \"sample_fmt\": \"fltp\", \"start_time\": \"0.000000\", \"disposition\": {\"dub\": 0, \"forced\": 0, \"lyrics\": 0, \"comment\": 0, \"default\": 1, \"karaoke\": 0, \"captions\": 0, \"metadata\": 0, \"original\": 0, \"dependent\": 0, \"multilayer\": 0, \"still_image\": 0, \"attached_pic\": 0, \"descriptions\": 0, \"non_diegetic\": 0, \"clean_effects\": 0, \"visual_impaired\": 0, \"hearing_impaired\": 0, \"timed_thumbnails\": 0}, \"duration_ts\": 2472960, \"sample_rate\": \"48000\", \"r_frame_rate\": \"0/0\", \"avg_frame_rate\": \"0/0\", \"channel_layout\": \"stereo\", \"extradata_size\": 5, \"bits_per_sample\": 0, \"codec_long_name\": \"AAC (Advanced Audio Coding)\", \"initial_padding\": 0, \"codec_tag_string\": \"mp4a\"}]}','completed',NULL,NULL,NULL,0,'2025-07-20 07:56:11','2025-07-20 07:56:27');

--
-- Table structure for table `clipmaker_media_backup_20250118`
--

CREATE TABLE `clipmaker_media_backup_20250118` (
  `id` int NOT NULL DEFAULT '0',
  `user_id` int NOT NULL,
  `project_id` int DEFAULT NULL COMMENT 'Média lié à un projet spécifique',
  `original_filename` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `stored_filename` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `file_path` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `file_type` enum('video','image','audio','text') COLLATE utf8mb4_unicode_ci NOT NULL,
  `mime_type` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `file_size` bigint NOT NULL,
  `width` int DEFAULT NULL,
  `height` int DEFAULT NULL,
  `duration` float DEFAULT NULL COMMENT 'Durée en secondes pour vidéo/audio',
  `thumbnail_path` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `waveform_path` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Waveform pour audio',
  `metadata` json DEFAULT NULL COMMENT 'Métadonnées FFprobe',
  `conversion_status` enum('pending','processing','completed','failed') COLLATE utf8mb4_unicode_ci DEFAULT 'completed',
  `conversion_log` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `ai_analysis` json DEFAULT NULL COMMENT 'Analyse IA (sous-titres, etc.)',
  `tags` json DEFAULT NULL COMMENT 'Tags utilisateur',
  `is_public` tinyint(1) DEFAULT '0' COMMENT 'Partageable entre projets',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `clipmaker_media_backup_20250118`
--

INSERT INTO `clipmaker_media_backup_20250118` VALUES (1,4,1,'lannsuri-ori.mp4','clipmaker_687a3e8cea0b3_1752841868.mp4','/../uploads/clipmaker/media/clipmaker_687a3e8cea0b3_1752841868.mp4','video','video/mp4',3448763,820,462,20.0873,NULL,NULL,'{\"fps\": 24, \"type\": \"video\", \"width\": 820, \"height\": 462, \"duration\": 20.087321}','completed',NULL,NULL,NULL,0,'2025-07-18 12:31:09','2025-07-18 12:31:09'),(2,4,NULL,'wildlife.mp4','clipmaker_687a412b06f47_1752842539.mp4','/../uploads/clipmaker/media/clipmaker_687a412b06f47_1752842539.mp4','video','video/mp4',32706193,1280,720,30.0967,NULL,NULL,'{\"fps\": 29.97002997002997, \"type\": \"video\", \"width\": 1280, \"height\": 720, \"duration\": 30.096733}','completed',NULL,NULL,NULL,0,'2025-07-18 12:42:19','2025-07-18 12:42:19'),(3,4,1,'lannsuri-ori.mp4','clipmaker_687a42363a218_1752842806.mp4','/../uploads/clipmaker/media/clipmaker_687a42363a218_1752842806.mp4','video','video/mp4',3448763,820,462,20.0873,NULL,NULL,'{\"fps\": 24, \"type\": \"video\", \"width\": 820, \"height\": 462, \"duration\": 20.087321}','completed',NULL,NULL,NULL,0,'2025-07-18 12:46:46','2025-07-18 12:46:46'),(4,4,2,'lannsuri-ori.mp4','clipmaker_687a44f76c80d_1752843511.mp4','/../uploads/clipmaker/media/clipmaker_687a44f76c80d_1752843511.mp4','video','video/mp4',3448763,820,462,20.0873,NULL,NULL,'{\"fps\": 24, \"type\": \"video\", \"width\": 820, \"height\": 462, \"duration\": 20.087321}','completed',NULL,NULL,NULL,0,'2025-07-18 12:58:31','2025-07-18 12:58:31');

--
-- Table structure for table `clipmaker_projects`
--

CREATE TABLE `clipmaker_projects` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int NOT NULL,
  `client_id` int DEFAULT NULL,
  `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `timeline_data` json NOT NULL COMMENT 'Structure complète du projet',
  `settings` json DEFAULT NULL COMMENT 'Résolution, FPS, format',
  `thumbnail_url` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `duration` float DEFAULT '0' COMMENT 'Durée totale en secondes',
  `resolution_width` int DEFAULT '1920',
  `resolution_height` int DEFAULT '1080',
  `fps` int DEFAULT '30',
  `status` enum('draft','editing','rendering','completed','error') COLLATE utf8mb4_unicode_ci DEFAULT 'draft',
  `export_path` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `export_settings` json DEFAULT NULL COMMENT 'Derniers paramètres export',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_user_id` (`user_id`),
  KEY `idx_client_id` (`client_id`),
  KEY `idx_status` (`status`),
  KEY `idx_created_at` (`created_at`),
  KEY `idx_projects_user_status` (`user_id`,`status`),
  CONSTRAINT `clipmaker_projects_client_fk` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE SET NULL,
  CONSTRAINT `clipmaker_projects_user_fk` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Projets Clipmaker Monster';

--
-- Dumping data for table `clipmaker_projects`
--

INSERT INTO `clipmaker_projects` VALUES (1,4,NULL,'Marloupin','','{\"clips\": [], \"version\": \"1.0\", \"duration\": 0}',NULL,NULL,0,1920,1080,30,'draft',NULL,NULL,'2025-07-19 06:31:10','2025-07-19 07:23:39');

--
-- Temporary view structure for view `clipmaker_recent_activity`
--

/*!50001 DROP VIEW IF EXISTS `clipmaker_recent_activity`*/;
/*!50001 CREATE VIEW `clipmaker_recent_activity` AS SELECT 
 1 AS `type`,
 1 AS `title`,
 1 AS `user_id`,
 1 AS `activity_date`,
 1 AS `description`*/;

--
-- Table structure for table `clipmaker_templates`
--

CREATE TABLE `clipmaker_templates` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int NOT NULL,
  `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `category` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'intro, outro, transition, etc.',
  `template_data` json NOT NULL COMMENT 'Structure du template',
  `thumbnail_url` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `duration` float DEFAULT NULL,
  `resolution_width` int DEFAULT '1920',
  `resolution_height` int DEFAULT '1080',
  `tags` json DEFAULT NULL,
  `is_public` tinyint(1) DEFAULT '0' COMMENT 'Partageable communauté',
  `usage_count` int DEFAULT '0',
  `rating` decimal(3,2) DEFAULT NULL COMMENT 'Note communauté 0-5',
  `rating_count` int DEFAULT '0',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_user_id` (`user_id`),
  KEY `idx_category` (`category`),
  KEY `idx_is_public` (`is_public`),
  KEY `idx_rating` (`rating`),
  CONSTRAINT `clipmaker_templates_user_fk` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Templates Clipmaker';

--
-- Dumping data for table `clipmaker_templates`
--


--
-- Table structure for table `clipmaker_transitions`
--

CREATE TABLE `clipmaker_transitions` (
  `id` int NOT NULL AUTO_INCREMENT,
  `name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `type` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `duration_min` decimal(5,2) DEFAULT '0.50',
  `duration_max` decimal(5,2) DEFAULT '3.00',
  `active` tinyint(1) DEFAULT '1',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=166 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `clipmaker_transitions`
--

INSERT INTO `clipmaker_transitions` VALUES (1,'Fondu','fade','Transition en fondu classique',0.50,3.00,1,'2025-07-18 15:57:35'),(2,'Coupe franche','cut','Changement immédiat',0.00,0.00,1,'2025-07-18 15:57:35'),(3,'Fondu croisé','crossfade','Fondu croisé entre deux clips',0.50,2.00,1,'2025-07-18 15:57:35'),(4,'Glissement','slide','Glissement latéral',0.50,2.00,1,'2025-07-18 15:57:35'),(5,'Zoom','zoom','Effet de zoom',0.50,2.00,1,'2025-07-18 15:57:35'),(6,'Fondu','fade','Transition en fondu classique',0.50,3.00,1,'2025-07-18 15:57:49'),(7,'Coupe franche','cut','Changement immédiat',0.00,0.00,1,'2025-07-18 15:57:49'),(8,'Fondu croisé','crossfade','Fondu croisé entre deux clips',0.50,2.00,1,'2025-07-18 15:57:49'),(9,'Glissement','slide','Glissement latéral',0.50,2.00,1,'2025-07-18 15:57:49'),(10,'Zoom','zoom','Effet de zoom',0.50,2.00,1,'2025-07-18 15:57:49'),(11,'Fondu','fade','Transition en fondu classique',0.50,3.00,1,'2025-07-18 15:57:49'),(12,'Coupe franche','cut','Changement immédiat',0.00,0.00,1,'2025-07-18 15:57:49'),(13,'Fondu croisé','crossfade','Fondu croisé entre deux clips',0.50,2.00,1,'2025-07-18 15:57:49'),(14,'Glissement','slide','Glissement latéral',0.50,2.00,1,'2025-07-18 15:57:49'),(15,'Zoom','zoom','Effet de zoom',0.50,2.00,1,'2025-07-18 15:57:49'),(16,'Fondu','fade','Transition en fondu classique',0.50,3.00,1,'2025-07-18 15:58:00'),(17,'Coupe franche','cut','Changement immédiat',0.00,0.00,1,'2025-07-18 15:58:00'),(18,'Fondu croisé','crossfade','Fondu croisé entre deux clips',0.50,2.00,1,'2025-07-18 15:58:00'),(19,'Glissement','slide','Glissement latéral',0.50,2.00,1,'2025-07-18 15:58:00'),(20,'Zoom','zoom','Effet de zoom',0.50,2.00,1,'2025-07-18 15:58:00'),(21,'Fondu','fade','Transition en fondu classique',0.50,3.00,1,'2025-07-18 15:59:32'),(22,'Coupe franche','cut','Changement immédiat',0.00,0.00,1,'2025-07-18 15:59:32'),(23,'Fondu croisé','crossfade','Fondu croisé entre deux clips',0.50,2.00,1,'2025-07-18 15:59:32'),(24,'Glissement','slide','Glissement latéral',0.50,2.00,1,'2025-07-18 15:59:32'),(25,'Zoom','zoom','Effet de zoom',0.50,2.00,1,'2025-07-18 15:59:32'),(26,'Fondu','fade','Transition en fondu classique',0.50,3.00,1,'2025-07-18 15:59:35'),(27,'Coupe franche','cut','Changement immédiat',0.00,0.00,1,'2025-07-18 15:59:35'),(28,'Fondu croisé','crossfade','Fondu croisé entre deux clips',0.50,2.00,1,'2025-07-18 15:59:35'),(29,'Glissement','slide','Glissement latéral',0.50,2.00,1,'2025-07-18 15:59:35'),(30,'Zoom','zoom','Effet de zoom',0.50,2.00,1,'2025-07-18 15:59:35'),(31,'Fondu','fade','Transition en fondu classique',0.50,3.00,1,'2025-07-18 15:59:50'),(32,'Coupe franche','cut','Changement immédiat',0.00,0.00,1,'2025-07-18 15:59:50'),(33,'Fondu croisé','crossfade','Fondu croisé entre deux clips',0.50,2.00,1,'2025-07-18 15:59:50'),(34,'Glissement','slide','Glissement latéral',0.50,2.00,1,'2025-07-18 15:59:50'),(35,'Zoom','zoom','Effet de zoom',0.50,2.00,1,'2025-07-18 15:59:50'),(36,'Fondu','fade','Transition en fondu classique',0.50,3.00,1,'2025-07-18 21:04:26'),(37,'Coupe franche','cut','Changement immédiat',0.00,0.00,1,'2025-07-18 21:04:26'),(38,'Fondu croisé','crossfade','Fondu croisé entre deux clips',0.50,2.00,1,'2025-07-18 21:04:26'),(39,'Glissement','slide','Glissement latéral',0.50,2.00,1,'2025-07-18 21:04:26'),(40,'Zoom','zoom','Effet de zoom',0.50,2.00,1,'2025-07-18 21:04:26'),(41,'Fondu','fade','Transition en fondu classique',0.50,3.00,1,'2025-07-18 21:04:36'),(42,'Coupe franche','cut','Changement immédiat',0.00,0.00,1,'2025-07-18 21:04:36'),(43,'Fondu croisé','crossfade','Fondu croisé entre deux clips',0.50,2.00,1,'2025-07-18 21:04:36'),(44,'Glissement','slide','Glissement latéral',0.50,2.00,1,'2025-07-18 21:04:36'),(45,'Zoom','zoom','Effet de zoom',0.50,2.00,1,'2025-07-18 21:04:36'),(46,'Fondu','fade','Transition en fondu classique',0.50,3.00,1,'2025-07-18 21:04:49'),(47,'Coupe franche','cut','Changement immédiat',0.00,0.00,1,'2025-07-18 21:04:49'),(48,'Fondu croisé','crossfade','Fondu croisé entre deux clips',0.50,2.00,1,'2025-07-18 21:04:49'),(49,'Glissement','slide','Glissement latéral',0.50,2.00,1,'2025-07-18 21:04:49'),(50,'Zoom','zoom','Effet de zoom',0.50,2.00,1,'2025-07-18 21:04:49'),(51,'Fondu','fade','Transition en fondu classique',0.50,3.00,1,'2025-07-18 21:05:32'),(52,'Coupe franche','cut','Changement immédiat',0.00,0.00,1,'2025-07-18 21:05:32'),(53,'Fondu croisé','crossfade','Fondu croisé entre deux clips',0.50,2.00,1,'2025-07-18 21:05:32'),(54,'Glissement','slide','Glissement latéral',0.50,2.00,1,'2025-07-18 21:05:32'),(55,'Zoom','zoom','Effet de zoom',0.50,2.00,1,'2025-07-18 21:05:32'),(56,'Fondu','fade','Transition en fondu classique',0.50,3.00,1,'2025-07-18 21:05:34'),(57,'Coupe franche','cut','Changement immédiat',0.00,0.00,1,'2025-07-18 21:05:34'),(58,'Fondu croisé','crossfade','Fondu croisé entre deux clips',0.50,2.00,1,'2025-07-18 21:05:34'),(59,'Glissement','slide','Glissement latéral',0.50,2.00,1,'2025-07-18 21:05:34'),(60,'Zoom','zoom','Effet de zoom',0.50,2.00,1,'2025-07-18 21:05:34'),(61,'Fondu','fade','Transition en fondu classique',0.50,3.00,1,'2025-07-18 21:05:40'),(62,'Coupe franche','cut','Changement immédiat',0.00,0.00,1,'2025-07-18 21:05:40'),(63,'Fondu croisé','crossfade','Fondu croisé entre deux clips',0.50,2.00,1,'2025-07-18 21:05:40'),(64,'Glissement','slide','Glissement latéral',0.50,2.00,1,'2025-07-18 21:05:40'),(65,'Zoom','zoom','Effet de zoom',0.50,2.00,1,'2025-07-18 21:05:40'),(66,'Fondu','fade','Transition en fondu classique',0.50,3.00,1,'2025-07-18 21:06:25'),(67,'Coupe franche','cut','Changement immédiat',0.00,0.00,1,'2025-07-18 21:06:25'),(68,'Fondu croisé','crossfade','Fondu croisé entre deux clips',0.50,2.00,1,'2025-07-18 21:06:25'),(69,'Glissement','slide','Glissement latéral',0.50,2.00,1,'2025-07-18 21:06:25'),(70,'Zoom','zoom','Effet de zoom',0.50,2.00,1,'2025-07-18 21:06:25'),(71,'Fondu','fade','Transition en fondu classique',0.50,3.00,1,'2025-07-18 21:06:29'),(72,'Coupe franche','cut','Changement immédiat',0.00,0.00,1,'2025-07-18 21:06:29'),(73,'Fondu croisé','crossfade','Fondu croisé entre deux clips',0.50,2.00,1,'2025-07-18 21:06:29'),(74,'Glissement','slide','Glissement latéral',0.50,2.00,1,'2025-07-18 21:06:29'),(75,'Zoom','zoom','Effet de zoom',0.50,2.00,1,'2025-07-18 21:06:29'),(76,'Fondu','fade','Transition en fondu classique',0.50,3.00,1,'2025-07-18 21:06:37'),(77,'Coupe franche','cut','Changement immédiat',0.00,0.00,1,'2025-07-18 21:06:37'),(78,'Fondu croisé','crossfade','Fondu croisé entre deux clips',0.50,2.00,1,'2025-07-18 21:06:37'),(79,'Glissement','slide','Glissement latéral',0.50,2.00,1,'2025-07-18 21:06:37'),(80,'Zoom','zoom','Effet de zoom',0.50,2.00,1,'2025-07-18 21:06:37'),(81,'Fondu','fade','Transition en fondu classique',0.50,3.00,1,'2025-07-18 21:09:10'),(82,'Coupe franche','cut','Changement immédiat',0.00,0.00,1,'2025-07-18 21:09:10'),(83,'Fondu croisé','crossfade','Fondu croisé entre deux clips',0.50,2.00,1,'2025-07-18 21:09:10'),(84,'Glissement','slide','Glissement latéral',0.50,2.00,1,'2025-07-18 21:09:10'),(85,'Zoom','zoom','Effet de zoom',0.50,2.00,1,'2025-07-18 21:09:10'),(86,'Fondu','fade','Transition en fondu classique',0.50,3.00,1,'2025-07-18 21:09:20'),(87,'Coupe franche','cut','Changement immédiat',0.00,0.00,1,'2025-07-18 21:09:20'),(88,'Fondu croisé','crossfade','Fondu croisé entre deux clips',0.50,2.00,1,'2025-07-18 21:09:20'),(89,'Glissement','slide','Glissement latéral',0.50,2.00,1,'2025-07-18 21:09:20'),(90,'Zoom','zoom','Effet de zoom',0.50,2.00,1,'2025-07-18 21:09:20'),(91,'Fondu','fade','Transition en fondu classique',0.50,3.00,1,'2025-07-18 21:09:20'),(92,'Coupe franche','cut','Changement immédiat',0.00,0.00,1,'2025-07-18 21:09:20'),(93,'Fondu croisé','crossfade','Fondu croisé entre deux clips',0.50,2.00,1,'2025-07-18 21:09:20'),(94,'Glissement','slide','Glissement latéral',0.50,2.00,1,'2025-07-18 21:09:20'),(95,'Zoom','zoom','Effet de zoom',0.50,2.00,1,'2025-07-18 21:09:20'),(96,'Fondu','fade','Transition en fondu classique',0.50,3.00,1,'2025-07-18 21:10:22'),(97,'Coupe franche','cut','Changement immédiat',0.00,0.00,1,'2025-07-18 21:10:22'),(98,'Fondu croisé','crossfade','Fondu croisé entre deux clips',0.50,2.00,1,'2025-07-18 21:10:22'),(99,'Glissement','slide','Glissement latéral',0.50,2.00,1,'2025-07-18 21:10:22'),(100,'Zoom','zoom','Effet de zoom',0.50,2.00,1,'2025-07-18 21:10:22'),(101,'Fondu','fade','Transition en fondu classique',0.50,3.00,1,'2025-07-18 21:10:22'),(102,'Coupe franche','cut','Changement immédiat',0.00,0.00,1,'2025-07-18 21:10:22'),(103,'Fondu croisé','crossfade','Fondu croisé entre deux clips',0.50,2.00,1,'2025-07-18 21:10:22'),(104,'Glissement','slide','Glissement latéral',0.50,2.00,1,'2025-07-18 21:10:22'),(105,'Zoom','zoom','Effet de zoom',0.50,2.00,1,'2025-07-18 21:10:22'),(106,'Fondu','fade','Transition en fondu classique',0.50,3.00,1,'2025-07-18 21:19:39'),(107,'Coupe franche','cut','Changement immédiat',0.00,0.00,1,'2025-07-18 21:19:39'),(108,'Fondu croisé','crossfade','Fondu croisé entre deux clips',0.50,2.00,1,'2025-07-18 21:19:39'),(109,'Glissement','slide','Glissement latéral',0.50,2.00,1,'2025-07-18 21:19:39'),(110,'Zoom','zoom','Effet de zoom',0.50,2.00,1,'2025-07-18 21:19:39'),(111,'Fondu','fade','Transition en fondu classique',0.50,3.00,1,'2025-07-18 21:19:42'),(112,'Coupe franche','cut','Changement immédiat',0.00,0.00,1,'2025-07-18 21:19:42'),(113,'Fondu croisé','crossfade','Fondu croisé entre deux clips',0.50,2.00,1,'2025-07-18 21:19:42'),(114,'Glissement','slide','Glissement latéral',0.50,2.00,1,'2025-07-18 21:19:42'),(115,'Zoom','zoom','Effet de zoom',0.50,2.00,1,'2025-07-18 21:19:42'),(116,'Fondu','fade','Transition en fondu classique',0.50,3.00,1,'2025-07-18 21:19:42'),(117,'Coupe franche','cut','Changement immédiat',0.00,0.00,1,'2025-07-18 21:19:42'),(118,'Fondu croisé','crossfade','Fondu croisé entre deux clips',0.50,2.00,1,'2025-07-18 21:19:42'),(119,'Glissement','slide','Glissement latéral',0.50,2.00,1,'2025-07-18 21:19:42'),(120,'Zoom','zoom','Effet de zoom',0.50,2.00,1,'2025-07-18 21:19:42'),(121,'Fondu','fade','Transition en fondu classique',0.50,3.00,1,'2025-07-18 21:19:44'),(122,'Coupe franche','cut','Changement immédiat',0.00,0.00,1,'2025-07-18 21:19:44'),(123,'Fondu croisé','crossfade','Fondu croisé entre deux clips',0.50,2.00,1,'2025-07-18 21:19:44'),(124,'Glissement','slide','Glissement latéral',0.50,2.00,1,'2025-07-18 21:19:44'),(125,'Zoom','zoom','Effet de zoom',0.50,2.00,1,'2025-07-18 21:19:44'),(126,'Fondu','fade','Transition en fondu classique',0.50,3.00,1,'2025-07-18 21:19:44'),(127,'Coupe franche','cut','Changement immédiat',0.00,0.00,1,'2025-07-18 21:19:44'),(128,'Fondu croisé','crossfade','Fondu croisé entre deux clips',0.50,2.00,1,'2025-07-18 21:19:44'),(129,'Glissement','slide','Glissement latéral',0.50,2.00,1,'2025-07-18 21:19:44'),(130,'Zoom','zoom','Effet de zoom',0.50,2.00,1,'2025-07-18 21:19:44'),(131,'Fondu','fade','Transition en fondu classique',0.50,3.00,1,'2025-07-18 21:19:52'),(132,'Coupe franche','cut','Changement immédiat',0.00,0.00,1,'2025-07-18 21:19:52'),(133,'Fondu croisé','crossfade','Fondu croisé entre deux clips',0.50,2.00,1,'2025-07-18 21:19:52'),(134,'Glissement','slide','Glissement latéral',0.50,2.00,1,'2025-07-18 21:19:52'),(135,'Zoom','zoom','Effet de zoom',0.50,2.00,1,'2025-07-18 21:19:52'),(136,'Fondu','fade','Transition en fondu classique',0.50,3.00,1,'2025-07-18 21:19:52'),(137,'Coupe franche','cut','Changement immédiat',0.00,0.00,1,'2025-07-18 21:19:52'),(138,'Fondu croisé','crossfade','Fondu croisé entre deux clips',0.50,2.00,1,'2025-07-18 21:19:52'),(139,'Glissement','slide','Glissement latéral',0.50,2.00,1,'2025-07-18 21:19:52'),(140,'Zoom','zoom','Effet de zoom',0.50,2.00,1,'2025-07-18 21:19:52'),(141,'Fondu','fade','Transition en fondu classique',0.50,3.00,1,'2025-07-18 21:20:11'),(142,'Coupe franche','cut','Changement immédiat',0.00,0.00,1,'2025-07-18 21:20:11'),(143,'Fondu croisé','crossfade','Fondu croisé entre deux clips',0.50,2.00,1,'2025-07-18 21:20:11'),(144,'Glissement','slide','Glissement latéral',0.50,2.00,1,'2025-07-18 21:20:11'),(145,'Zoom','zoom','Effet de zoom',0.50,2.00,1,'2025-07-18 21:20:11'),(146,'Fondu','fade','Transition en fondu classique',0.50,3.00,1,'2025-07-18 21:20:12'),(147,'Coupe franche','cut','Changement immédiat',0.00,0.00,1,'2025-07-18 21:20:12'),(148,'Fondu croisé','crossfade','Fondu croisé entre deux clips',0.50,2.00,1,'2025-07-18 21:20:12'),(149,'Glissement','slide','Glissement latéral',0.50,2.00,1,'2025-07-18 21:20:12'),(150,'Zoom','zoom','Effet de zoom',0.50,2.00,1,'2025-07-18 21:20:12'),(151,'Fondu','fade','Transition en fondu classique',0.50,3.00,1,'2025-07-18 21:20:13'),(152,'Coupe franche','cut','Changement immédiat',0.00,0.00,1,'2025-07-18 21:20:13'),(153,'Fondu croisé','crossfade','Fondu croisé entre deux clips',0.50,2.00,1,'2025-07-18 21:20:13'),(154,'Glissement','slide','Glissement latéral',0.50,2.00,1,'2025-07-18 21:20:13'),(155,'Zoom','zoom','Effet de zoom',0.50,2.00,1,'2025-07-18 21:20:13'),(156,'Fondu','fade','Transition en fondu classique',0.50,3.00,1,'2025-07-18 21:28:26'),(157,'Coupe franche','cut','Changement immédiat',0.00,0.00,1,'2025-07-18 21:28:26'),(158,'Fondu croisé','crossfade','Fondu croisé entre deux clips',0.50,2.00,1,'2025-07-18 21:28:26'),(159,'Glissement','slide','Glissement latéral',0.50,2.00,1,'2025-07-18 21:28:26'),(160,'Zoom','zoom','Effet de zoom',0.50,2.00,1,'2025-07-18 21:28:26'),(161,'Fondu','fade','Transition en fondu classique',0.50,3.00,1,'2025-07-18 21:28:26'),(162,'Coupe franche','cut','Changement immédiat',0.00,0.00,1,'2025-07-18 21:28:26'),(163,'Fondu croisé','crossfade','Fondu croisé entre deux clips',0.50,2.00,1,'2025-07-18 21:28:26'),(164,'Glissement','slide','Glissement latéral',0.50,2.00,1,'2025-07-18 21:28:26'),(165,'Zoom','zoom','Effet de zoom',0.50,2.00,1,'2025-07-18 21:28:26');

--
-- Temporary view structure for view `clipmaker_user_stats`
--

/*!50001 DROP VIEW IF EXISTS `clipmaker_user_stats`*/;
/*!50001 CREATE VIEW `clipmaker_user_stats` AS SELECT 
 1 AS `user_id`,
 1 AS `user_name`,
 1 AS `total_projects`,
 1 AS `total_media`,
 1 AS `total_exports`,
 1 AS `completed_projects`,
 1 AS `successful_exports`,
 1 AS `total_storage_used`,
 1 AS `last_project_date`*/;

--
-- Table structure for table `clips_masters`
--

CREATE TABLE `clips_masters` (
  `id` int NOT NULL AUTO_INCREMENT,
  `projet` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `chemin` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `prefix` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `thumb_start` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `thumb_end` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `clips_masters`
--


--
-- Table structure for table `clips_projets`
--

CREATE TABLE `clips_projets` (
  `id` int NOT NULL AUTO_INCREMENT,
  `projet` varchar(255) DEFAULT NULL,
  `chemin_master` varchar(255) DEFAULT NULL,
  `chemin_json` varchar(255) DEFAULT NULL,
  `reseau` varchar(50) DEFAULT NULL,
  `etat` enum('init','upload','verifie','decoupe','organise','assemble','termine') DEFAULT 'init',
  `date_creation` datetime DEFAULT CURRENT_TIMESTAMP,
  `date_modif` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `projet` (`projet`),
  UNIQUE KEY `projet_2` (`projet`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `clips_projets`
--


--
-- Table structure for table `configuration`
--

CREATE TABLE `configuration` (
  `config_key` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `config_value` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  PRIMARY KEY (`config_key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `configuration`
--

INSERT INTO `configuration` VALUES ('clipmaker_ai_enabled','1'),('clipmaker_ai_provider','openai'),('clipmaker_allowed_formats','[\"mp4\",\"webm\",\"mov\",\"avi\",\"mkv\",\"jpg\",\"jpeg\",\"png\",\"webp\",\"mp3\",\"wav\",\"ogg\"]'),('clipmaker_default_fps','30'),('clipmaker_default_resolution','1920x1080'),('clipmaker_default_transition_duration','1.0'),('clipmaker_export_quality_high','{\"crf\": 18, \"preset\": \"medium\"}'),('clipmaker_export_quality_low','{\"crf\": 28, \"preset\": \"faster\"}'),('clipmaker_export_quality_medium','{\"crf\": 23, \"preset\": \"fast\"}'),('clipmaker_ffmpeg_threads','4'),('clipmaker_max_file_size','524288000'),('clipmaker_max_project_duration','3600'),('clipmaker_storage_path','/uploads/clipmaker/'),('clipmaker_temp_path','/tmp/clipmaker/'),('clipmaker_transitions_enabled','1');

--
-- Table structure for table `data_ia`
--

CREATE TABLE `data_ia` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int DEFAULT '0',
  `prompt` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `reponse` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `modele` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT 'openai/gpt-3.5-turbo',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `data_ia`
--


--
-- Table structure for table `facebook_old`
--

CREATE TABLE `facebook_old` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int DEFAULT NULL,
  `citation` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `post` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `image` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `hashtags` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `horodatage` datetime DEFAULT CURRENT_TIMESTAMP,
  `tokens_used` int DEFAULT '0',
  `media_type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT 'image',
  `ready_start` tinyint DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `fk_facebook_user` (`user_id`),
  CONSTRAINT `fk_facebook_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `facebook_old`
--


--
-- Table structure for table `flying_book_activity_logs`
--

CREATE TABLE `flying_book_activity_logs` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int DEFAULT NULL,
  `action` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `entity_type` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'project, user, template, etc.',
  `entity_id` int DEFAULT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `ip_address` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `user_agent` text COLLATE utf8mb4_unicode_ci,
  `metadata` json DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_user_activity` (`user_id`,`created_at`),
  KEY `idx_action` (`action`),
  KEY `idx_entity` (`entity_type`,`entity_id`),
  CONSTRAINT `flying_book_activity_logs_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `flying_book_activity_logs`
--


--
-- Table structure for table `flying_book_leads`
--

CREATE TABLE `flying_book_leads` (
  `id` int NOT NULL AUTO_INCREMENT,
  `project_id` int NOT NULL,
  `share_id` int DEFAULT NULL,
  `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `phone` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `company` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `job_title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `message` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `custom_fields` json DEFAULT NULL COMMENT 'Champs personnalisés',
  `source_slide` int DEFAULT NULL COMMENT 'Slide où le lead a été capturé',
  `utm_data` json DEFAULT NULL COMMENT 'Données UTM',
  `visitor_data` json DEFAULT NULL COMMENT 'Données visiteur (IP, UA, etc.)',
  `status` enum('new','contacted','qualified','converted','lost') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT 'new',
  `score` int DEFAULT '0' COMMENT 'Score du lead 0-100',
  `notes` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `assigned_to` int DEFAULT NULL COMMENT 'Utilisateur assigné',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_project_leads` (`project_id`),
  KEY `idx_lead_status` (`status`),
  KEY `idx_lead_score` (`score` DESC),
  KEY `idx_lead_email` (`email`),
  KEY `idx_assigned_to` (`assigned_to`),
  KEY `fk_flying_leads_share` (`share_id`),
  CONSTRAINT `fk_flying_leads_assigned` FOREIGN KEY (`assigned_to`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  CONSTRAINT `fk_flying_leads_project` FOREIGN KEY (`project_id`) REFERENCES `flying_book_projects` (`id`) ON DELETE CASCADE,
  CONSTRAINT `fk_flying_leads_share` FOREIGN KEY (`share_id`) REFERENCES `flying_book_shares` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `flying_book_leads`
--


--
-- Table structure for table `flying_book_media`
--

CREATE TABLE `flying_book_media` (
  `id` int NOT NULL AUTO_INCREMENT,
  `project_id` int NOT NULL,
  `user_id` int NOT NULL,
  `original_filename` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `stored_filename` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `file_path` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `file_type` enum('image','video','audio','document') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `mime_type` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `file_size` bigint NOT NULL,
  `dimensions` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'ex: 1920x1080',
  `duration` float DEFAULT NULL COMMENT 'Durée en secondes pour vidéo/audio',
  `thumbnail_path` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `compression_quality` enum('low','medium','high','original') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT 'medium',
  `compression_applied` tinyint(1) DEFAULT '0',
  `optimization_log` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT 'Log des optimisations appliquées',
  `cdn_url` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'URL CDN si applicable',
  `upload_status` enum('uploading','processing','ready','error','deleted') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT 'ready',
  `upload_progress` int DEFAULT '0' COMMENT 'Progression upload 0-100%',
  `error_message` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `alt_text` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Texte alternatif pour accessibilité',
  `tags` json DEFAULT NULL COMMENT 'Tags pour recherche',
  `metadata` json DEFAULT NULL COMMENT 'Métadonnées EXIF/autres',
  `usage_count` int DEFAULT '0' COMMENT 'Nombre d''utilisations',
  PRIMARY KEY (`id`),
  KEY `idx_project_media` (`project_id`,`file_type`),
  KEY `idx_user_media` (`user_id`),
  KEY `idx_upload_status` (`upload_status`),
  KEY `idx_file_size` (`file_size`),
  KEY `idx_media_tags` (`file_type`,`upload_status`),
  KEY `idx_media_search` (`original_filename`,`alt_text`),
  CONSTRAINT `fk_flying_media_project` FOREIGN KEY (`project_id`) REFERENCES `flying_book_projects` (`id`) ON DELETE CASCADE,
  CONSTRAINT `fk_flying_media_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `flying_book_media`
--


--
-- Table structure for table `flying_book_notifications`
--

CREATE TABLE `flying_book_notifications` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int NOT NULL,
  `type` enum('info','success','warning','error','upgrade') COLLATE utf8mb4_unicode_ci DEFAULT 'info',
  `title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `message` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `action_url` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `action_text` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `is_read` tinyint(1) DEFAULT '0',
  `is_system` tinyint(1) DEFAULT '0' COMMENT 'Notification système vs utilisateur',
  `expires_at` datetime DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `read_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_user_notifications` (`user_id`,`is_read`,`created_at`),
  KEY `idx_expires` (`expires_at`),
  CONSTRAINT `flying_book_notifications_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `flying_book_notifications`
--


--
-- Table structure for table `flying_book_project_configs`
--

CREATE TABLE `flying_book_project_configs` (
  `id` int NOT NULL AUTO_INCREMENT,
  `project_id` int NOT NULL,
  `advanced_config` json NOT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `unique_project_config` (`project_id`),
  CONSTRAINT `flying_book_project_configs_ibfk_1` FOREIGN KEY (`project_id`) REFERENCES `flying_book_projects` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `flying_book_project_configs`
--


--
-- Table structure for table `flying_book_project_tags`
--

CREATE TABLE `flying_book_project_tags` (
  `id` int NOT NULL AUTO_INCREMENT,
  `project_id` int NOT NULL,
  `tag_name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `tag_color` varchar(7) COLLATE utf8mb4_unicode_ci DEFAULT '#667eea',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_project_tags` (`project_id`),
  KEY `idx_tag_name` (`tag_name`),
  CONSTRAINT `flying_book_project_tags_ibfk_1` FOREIGN KEY (`project_id`) REFERENCES `flying_book_projects` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `flying_book_project_tags`
--


--
-- Table structure for table `flying_book_project_versions`
--

CREATE TABLE `flying_book_project_versions` (
  `id` int NOT NULL AUTO_INCREMENT,
  `project_id` int NOT NULL,
  `version_number` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
  `backup_data` longtext COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'JSON backup complet du projet',
  `backup_size` bigint DEFAULT '0',
  `created_by` int DEFAULT NULL,
  `is_auto_backup` tinyint(1) DEFAULT '1',
  `notes` text COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_project_versions` (`project_id`,`created_at`),
  KEY `idx_version_number` (`version_number`),
  KEY `created_by` (`created_by`),
  CONSTRAINT `flying_book_project_versions_ibfk_1` FOREIGN KEY (`project_id`) REFERENCES `flying_book_projects` (`id`) ON DELETE CASCADE,
  CONSTRAINT `flying_book_project_versions_ibfk_2` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `flying_book_project_versions`
--


--
-- Table structure for table `flying_book_settings`
--

CREATE TABLE `flying_book_settings` (
  `id` int NOT NULL AUTO_INCREMENT,
  `setting_key` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `setting_value` text COLLATE utf8mb4_unicode_ci,
  `setting_type` enum('string','integer','boolean','json') COLLATE utf8mb4_unicode_ci DEFAULT 'string',
  `category` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT 'general',
  `description` text COLLATE utf8mb4_unicode_ci,
  `is_public` tinyint(1) DEFAULT '0' COMMENT 'Visible aux utilisateurs',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `unique_setting_key` (`setting_key`),
  KEY `idx_category` (`category`)
) ENGINE=InnoDB AUTO_INCREMENT=56 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `flying_book_settings`
--

INSERT INTO `flying_book_settings` VALUES (1,'app_name','Flying Book Creator','string','general','Nom de l\'application',1,'2025-08-01 05:57:44','2025-08-01 05:57:44'),(2,'app_version','2.0.0','string','general','Version de l\'application',1,'2025-08-01 05:57:44','2025-08-01 05:57:44'),(3,'maintenance_mode','0','boolean','system','Mode maintenance activé',0,'2025-08-01 05:57:44','2025-08-01 05:57:44'),(4,'registration_enabled','1','boolean','users','Permettre les nouvelles inscriptions',0,'2025-08-01 05:57:44','2025-08-01 05:57:44'),(5,'max_file_size','524288000','integer','uploads','Taille max fichier en bytes (500MB)',0,'2025-08-01 05:57:44','2025-08-01 05:57:44'),(6,'allowed_file_types','jpg,jpeg,png,gif,webp,mp4,webm,mov,mp3,wav,ogg,pdf','string','uploads','Types de fichiers autorisés',0,'2025-08-01 05:57:44','2025-08-01 05:57:44'),(7,'default_theme','moderne','string','appearance','Thème par défaut',1,'2025-08-01 05:57:44','2025-08-01 05:57:44'),(8,'analytics_enabled','1','boolean','features','Analytics activées',0,'2025-08-01 05:57:44','2025-08-01 05:57:44'),(9,'watermark_text','Created with Flying Book','string','branding','Texte du watermark par défaut',0,'2025-08-01 05:57:44','2025-08-01 05:57:44'),(10,'smtp_enabled','1','boolean','email','SMTP activé',0,'2025-08-01 05:57:44','2025-08-01 05:57:44'),(11,'backup_retention_days','30','integer','backup','Durée de rétention des backups en jours',0,'2025-08-01 05:57:44','2025-08-01 05:57:44');

--
-- Table structure for table `flying_book_slides`
--

CREATE TABLE `flying_book_slides` (
  `id` int NOT NULL AUTO_INCREMENT,
  `project_id` int NOT NULL,
  `slide_number` int NOT NULL,
  `slide_title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `media_type` enum('image','video','audio_image','text_image','interactive') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `media_file` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `media_thumbnail` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `background_audio` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `auto_duration` int DEFAULT NULL COMMENT 'Durée auto en secondes',
  `video_settings` json DEFAULT NULL COMMENT 'Paramètres vidéo (autoplay, muted, etc.)',
  `text_overlay` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT 'Texte superposé optionnel',
  `slide_notes` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT 'Notes pour le présentateur',
  `transition_in` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `transition_out` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `animation_effects` json DEFAULT NULL COMMENT 'Effets animations premium',
  `interactive_elements` json DEFAULT NULL COMMENT 'Éléments interactifs (boutons, liens)',
  `display_order` int NOT NULL DEFAULT '0',
  `is_active` tinyint(1) DEFAULT '1',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `powerpoint_animations` text COLLATE utf8mb4_unicode_ci,
  PRIMARY KEY (`id`),
  UNIQUE KEY `project_slide_unique` (`project_id`,`slide_number`),
  KEY `idx_project_order` (`project_id`,`display_order`),
  KEY `idx_slide_active` (`is_active`),
  CONSTRAINT `fk_flying_slides_project` FOREIGN KEY (`project_id`) REFERENCES `flying_book_projects` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `flying_book_slides`
--


--
-- Table structure for table `flying_book_subscriptions`
--

CREATE TABLE `flying_book_subscriptions` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int NOT NULL,
  `plan_type` enum('free','pro','business','enterprise') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `plan_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `price_monthly` decimal(10,2) NOT NULL DEFAULT '0.00',
  `price_yearly` decimal(10,2) NOT NULL DEFAULT '0.00',
  `billing_cycle` enum('monthly','yearly','lifetime') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT 'monthly',
  `stripe_subscription_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `stripe_customer_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `status` enum('active','cancelled','expired','past_due','trialing') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT 'active',
  `trial_ends_at` timestamp NULL DEFAULT NULL,
  `current_period_start` timestamp NOT NULL,
  `current_period_end` timestamp NOT NULL,
  `cancelled_at` timestamp NULL DEFAULT NULL,
  `features` json NOT NULL COMMENT 'Fonctionnalités incluses',
  `limits` json NOT NULL COMMENT 'Limites du plan (projets, storage, etc.)',
  `usage_stats` json DEFAULT NULL COMMENT 'Utilisation actuelle',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `user_active_subscription` (`user_id`,`status`),
  KEY `idx_subscription_status` (`status`),
  KEY `idx_subscription_ends` (`current_period_end`),
  KEY `idx_stripe_subscription` (`stripe_subscription_id`),
  KEY `idx_flying_subscriptions_active` (`status`,`current_period_end`),
  CONSTRAINT `fk_flying_subscriptions_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `flying_book_subscriptions`
--


--
-- Table structure for table `flying_book_template_sales`
--

CREATE TABLE `flying_book_template_sales` (
  `id` int NOT NULL AUTO_INCREMENT,
  `template_id` int NOT NULL,
  `buyer_id` int NOT NULL,
  `seller_id` int NOT NULL,
  `sale_price` decimal(10,2) NOT NULL,
  `commission_amount` decimal(10,2) NOT NULL,
  `seller_earning` decimal(10,2) NOT NULL,
  `payment_status` enum('pending','completed','failed','refunded') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT 'pending',
  `stripe_payment_intent_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `refund_reason` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `completed_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_template_sales` (`template_id`),
  KEY `idx_buyer_sales` (`buyer_id`),
  KEY `idx_seller_sales` (`seller_id`),
  KEY `idx_payment_status` (`payment_status`),
  KEY `idx_sales_date` (`created_at` DESC),
  CONSTRAINT `fk_template_sales_buyer` FOREIGN KEY (`buyer_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  CONSTRAINT `fk_template_sales_seller` FOREIGN KEY (`seller_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  CONSTRAINT `fk_template_sales_template` FOREIGN KEY (`template_id`) REFERENCES `flying_book_templates` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `flying_book_template_sales`
--


--
-- Table structure for table `flying_book_templates`
--

CREATE TABLE `flying_book_templates` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int NOT NULL,
  `template_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `template_description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `category` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT 'custom' COMMENT 'business, education, portfolio, marketing, sales',
  `template_config` json NOT NULL COMMENT 'Configuration complète du template',
  `preview_image` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `demo_url` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `is_public` tinyint(1) DEFAULT '0',
  `is_premium` tinyint(1) DEFAULT '0' COMMENT 'Template payant',
  `price` decimal(10,2) DEFAULT '0.00' COMMENT 'Prix du template premium',
  `usage_count` int DEFAULT '0',
  `rating` decimal(3,2) DEFAULT '0.00',
  `rating_count` int DEFAULT '0',
  `sales_count` int DEFAULT '0' COMMENT 'Nombre de ventes',
  `commission_rate` decimal(5,2) DEFAULT '30.00' COMMENT 'Commission créateur %',
  `tags` json DEFAULT NULL COMMENT 'Tags pour recherche',
  `is_featured` tinyint(1) DEFAULT '0' COMMENT 'Template mis en avant',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_template_category` (`category`,`is_public`),
  KEY `idx_template_rating` (`rating` DESC),
  KEY `idx_template_user` (`user_id`),
  KEY `idx_template_premium` (`is_premium`,`price`),
  KEY `idx_template_featured` (`is_featured`,`rating` DESC),
  KEY `idx_flying_templates_featured_rating` (`is_featured`,`rating` DESC,`sales_count` DESC),
  CONSTRAINT `fk_flying_templates_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `flying_book_templates`
--

INSERT INTO `flying_book_templates` VALUES (1,1,'Présentation Business Moderne','Template professionnel parfait pour les présentations d\'entreprise avec design épuré et sections structurées.','business','{\"theme\": \"corporate\", \"title\": \"Notre Entreprise\", \"slides\": [{\"type\": \"text_image\", \"media\": \"slide-welcome.jpg\", \"title\": \"Bienvenue\", \"content\": \"<h1>Bienvenue dans notre entreprise</h1><p>Votre partenaire de confiance depuis 2020</p>\"}, {\"type\": \"text_image\", \"media\": \"slide-about.jpg\", \"title\": \"Qui sommes-nous ?\", \"content\": \"<h2>À propos de nous</h2><ul><li>Expertise reconnue</li><li>Équipe passionnée</li><li>Solutions innovantes</li></ul>\"}, {\"type\": \"text_image\", \"media\": \"slide-services.jpg\", \"title\": \"Nos Services\", \"content\": \"<h2>Nos Services</h2><div>Conseil • Formation • Support</div>\"}, {\"type\": \"text_image\", \"media\": \"slide-contact.jpg\", \"title\": \"Contact\", \"content\": \"<h2>Contactez-nous</h2><p>Email: contact@entreprise.com<br>Tél: 01 23 45 67 89</p>\"}], \"navigation\": \"all\", \"transition\": \"fade\", \"description\": \"Présentation professionnelle moderne\"}',NULL,NULL,1,0,0.00,127,4.80,45,0,30.00,NULL,1,'2025-08-01 08:47:27','2025-08-01 08:47:27'),(2,1,'Formation Interactive','Template éducatif avec sections quiz, objectifs pédagogiques et suivi de progression.','education','{\"theme\": \"moderne\", \"title\": \"Formation Marketing Digital\", \"slides\": [{\"type\": \"text_image\", \"media\": \"edu-intro.jpg\", \"title\": \"Introduction\", \"content\": \"<h1>Marketing Digital</h1><p>Les fondamentaux pour débuter</p>\"}, {\"type\": \"text_image\", \"media\": \"edu-objectives.jpg\", \"title\": \"Objectifs\", \"content\": \"<h2>Objectifs de la formation</h2><ul><li>Comprendre les bases</li><li>Maîtriser les outils</li><li>Créer sa première campagne</li></ul>\"}, {\"type\": \"text_image\", \"media\": \"edu-chapter1.jpg\", \"title\": \"Chapitre 1\", \"content\": \"<h2>1. Le Marketing Digital</h2><p>Définitions et concepts clés</p>\"}, {\"type\": \"text_image\", \"media\": \"edu-summary.jpg\", \"title\": \"Récapitulatif\", \"content\": \"<h2>Ce que vous avez appris</h2><ul><li>Définition du marketing digital</li><li>Principaux canaux</li><li>Bonnes pratiques</li></ul>\"}], \"navigation\": \"all\", \"transition\": \"slide\", \"description\": \"Module de formation interactif\"}',NULL,NULL,1,0,0.00,89,4.60,38,0,30.00,NULL,1,'2025-08-01 08:47:27','2025-08-01 08:47:27'),(3,1,'Portfolio Créatif','Showcase élégant pour présenter vos créations, projets et réalisations avec style.','portfolio','{\"theme\": \"premium\", \"title\": \"Mon Portfolio Créatif\", \"slides\": [{\"type\": \"text_image\", \"media\": \"portfolio-home.jpg\", \"title\": \"Accueil\", \"content\": \"<h1>John Doe</h1><h2>Designer & Développeur</h2><p>Créateur d\'expériences digitales uniques</p>\"}, {\"type\": \"text_image\", \"media\": \"portfolio-about.jpg\", \"title\": \"À propos\", \"content\": \"<h2>À propos de moi</h2><p>Passionné par le design et la technologie depuis plus de 5 ans.</p>\"}, {\"type\": \"image\", \"media\": \"portfolio-project1.jpg\", \"title\": \"Projet 1\", \"content\": \"<h3>Application Mobile</h3><p>Design UX/UI pour une app de fitness</p>\"}, {\"type\": \"text_image\", \"media\": \"portfolio-contact.jpg\", \"title\": \"Contact\", \"content\": \"<h2>Travaillons ensemble</h2><p>Email: john.doe@email.com<br>LinkedIn: linkedin.com/in/johndoe</p>\"}], \"navigation\": \"all\", \"transition\": \"3d\", \"description\": \"Présentation de mes réalisations\"}',NULL,NULL,1,0,0.00,156,4.90,52,0,30.00,NULL,1,'2025-08-01 08:47:27','2025-08-01 08:47:27'),(4,1,'Pitch Startup','Template parfait pour pitcher votre startup avec structure investor-ready et métriques clés.','business','{\"theme\": \"moderne\", \"title\": \"Pitch Deck - StartupName\", \"slides\": [{\"type\": \"text_image\", \"media\": \"pitch-problem.jpg\", \"title\": \"Problème\", \"content\": \"<h1>Le Problème</h1><p>73% des entreprises perdent du temps sur des tâches répétitives.</p>\"}, {\"type\": \"text_image\", \"media\": \"pitch-solution.jpg\", \"title\": \"Solution\", \"content\": \"<h1>Notre Solution</h1><p>Une plateforme IA qui automatise vos processus métier.</p>\"}, {\"type\": \"text_image\", \"media\": \"pitch-market.jpg\", \"title\": \"Marché\", \"content\": \"<h1>Taille du Marché</h1><h2>32 Milliards €</h2><p>Marché de l\'automatisation en Europe</p>\"}, {\"type\": \"text_image\", \"media\": \"pitch-funding.jpg\", \"title\": \"Financement\", \"content\": \"<h1>Levée de Fonds</h1><h2>500K€</h2><p>Pour développer notre équipe tech</p>\"}], \"navigation\": \"buttons\", \"transition\": \"fade\", \"description\": \"Présentation investisseurs\"}',NULL,NULL,1,0,0.00,73,4.70,29,0,30.00,NULL,1,'2025-08-01 08:47:27','2025-08-01 08:47:27'),(5,1,'Lancement Produit','Template marketing pour présenter un nouveau produit avec features, bénéfices et call-to-action.','marketing','{\"theme\": \"premium\", \"title\": \"Nouveau Produit - ProductName\", \"slides\": [{\"type\": \"text_image\", \"media\": \"product-announce.jpg\", \"title\": \"Annonce\", \"content\": \"<h1>Découvrez ProductName</h1><p>La révolution que vous attendiez</p>\"}, {\"type\": \"text_image\", \"media\": \"product-features.jpg\", \"title\": \"Fonctionnalités\", \"content\": \"<h2>Fonctionnalités Principales</h2><div>Ultra-rapide • Sécurisé • Multi-plateforme • Personnalisable</div>\"}, {\"type\": \"text_image\", \"media\": \"product-benefits.jpg\", \"title\": \"Bénéfices\", \"content\": \"<h2>Pourquoi choisir ProductName ?</h2><ul><li>Économisez 3h par jour</li><li>Réduisez vos coûts de 40%</li><li>Boostez votre productivité</li></ul>\"}, {\"type\": \"text_image\", \"media\": \"product-cta.jpg\", \"title\": \"Action\", \"content\": \"<h1>Prêt à commencer ?</h1><p>Rejoignez plus de 10,000 utilisateurs satisfaits</p>\"}], \"navigation\": \"all\", \"transition\": \"flip\", \"description\": \"Présentation de lancement\"}',NULL,NULL,1,0,0.00,112,4.50,34,0,30.00,NULL,1,'2025-08-01 08:47:27','2025-08-01 08:47:27'),(6,1,'Réunion Équipe','Template pour vos réunions d\'équipe avec agenda, KPIs et points d\'action.','business','{\"theme\": \"corporate\", \"title\": \"Réunion Équipe - Semaine 15\", \"slides\": [{\"type\": \"text_image\", \"media\": \"meeting-agenda.jpg\", \"title\": \"Agenda\", \"content\": \"<h1>Agenda de la Réunion</h1><ol><li>Résultats de la semaine</li><li>Objectifs à venir</li><li>Points bloquants</li><li>Actions à mener</li></ol>\"}, {\"type\": \"text_image\", \"media\": \"meeting-kpis.jpg\", \"title\": \"KPIs\", \"content\": \"<h2>KPIs de la Semaine</h2><div>Ventes: +15% | Équipe: 12 personnes | Objectifs: 85% OK</div>\"}, {\"type\": \"text_image\", \"media\": \"meeting-actions.jpg\", \"title\": \"Actions\", \"content\": \"<h2>Actions à Mener</h2><p>• Recruter développeur (RH - 15/03)<br>• Planifier formation (Manager - 20/03)</p>\"}], \"navigation\": \"all\", \"transition\": \"slide\", \"description\": \"Point hebdomadaire équipe\"}',NULL,NULL,1,0,0.00,45,4.20,18,0,30.00,NULL,0,'2025-08-01 08:47:27','2025-08-01 08:47:27'),(7,1,'Événement Conference','Template pour annoncer et présenter votre événement avec programme et speakers.','marketing','{\"theme\": \"premium\", \"title\": \"TechConf 2024 - La Conférence Tech\", \"slides\": [{\"type\": \"text_image\", \"media\": \"event-hero.jpg\", \"title\": \"Événement\", \"content\": \"<h1>TechConf 2024</h1><p>La conférence tech incontournable</p><div>15-16 Mars 2024 | Paris Expo | 2000+ participants</div>\"}, {\"type\": \"text_image\", \"media\": \"event-program.jpg\", \"title\": \"Programme\", \"content\": \"<h2>Programme</h2><div>9h00 - Accueil<br>10h00 - Keynote<br>11h30 - Sessions<br>14h00 - Ateliers<br>17h00 - Clôture</div>\"}, {\"type\": \"text_image\", \"media\": \"event-register.jpg\", \"title\": \"Inscription\", \"content\": \"<h1>Rejoignez-nous !</h1><p>Places limitées</p><div>Early Bird: 199€ | Standard: 299€</div>\"}], \"navigation\": \"all\", \"transition\": \"3d\", \"description\": \"Événement technologique majeur\"}',NULL,NULL,1,0,0.00,67,4.40,22,0,30.00,NULL,1,'2025-08-01 08:47:27','2025-08-01 08:47:27');

--
-- Table structure for table `flying_book_user_quotas`
--

CREATE TABLE `flying_book_user_quotas` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int NOT NULL,
  `quota_type` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'max_projects, max_storage, max_slides_per_project',
  `quota_limit` bigint NOT NULL COMMENT 'Limite personnalisée (-1 = illimité)',
  `current_usage` bigint DEFAULT '0',
  `reset_period` enum('daily','weekly','monthly','yearly','never') COLLATE utf8mb4_unicode_ci DEFAULT 'monthly',
  `last_reset` datetime DEFAULT NULL,
  `set_by_admin` int DEFAULT NULL,
  `reason` text COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `unique_user_quota` (`user_id`,`quota_type`),
  KEY `idx_quota_type` (`quota_type`),
  KEY `set_by_admin` (`set_by_admin`),
  CONSTRAINT `flying_book_user_quotas_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  CONSTRAINT `flying_book_user_quotas_ibfk_2` FOREIGN KEY (`set_by_admin`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `flying_book_user_quotas`
--


--
-- Table structure for table `flying_book_user_sessions`
--

CREATE TABLE `flying_book_user_sessions` (
  `id` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `user_id` int NOT NULL,
  `ip_address` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `user_agent` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `last_activity` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `expires_at` timestamp NOT NULL,
  `is_active` tinyint(1) DEFAULT '1',
  PRIMARY KEY (`id`),
  KEY `idx_user_sessions` (`user_id`,`is_active`),
  KEY `idx_session_cleanup` (`expires_at`,`is_active`),
  CONSTRAINT `fk_user_sessions_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `flying_book_user_sessions`
--


--
-- Table structure for table `flying_book_user_settings`
--

CREATE TABLE `flying_book_user_settings` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int NOT NULL,
  `setting_key` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `setting_value` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `setting_type` enum('string','int','bool','json') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT 'string',
  `is_encrypted` tinyint(1) DEFAULT '0',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `user_setting_unique` (`user_id`,`setting_key`),
  KEY `idx_user_settings` (`user_id`),
  CONSTRAINT `fk_user_settings_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `flying_book_user_settings`
--

INSERT INTO `flying_book_user_settings` VALUES (1,1,'theme','moderne','string',0,'2025-08-01 20:52:03','2025-08-01 20:52:03'),(2,4,'theme','moderne','string',0,'2025-08-01 20:52:03','2025-08-01 20:52:03'),(3,5,'theme','moderne','string',0,'2025-08-01 20:52:03','2025-08-01 20:52:03'),(4,6,'theme','moderne','string',0,'2025-08-01 20:52:03','2025-08-01 20:52:03'),(8,1,'dashboard_layout','grid','string',0,'2025-08-01 20:52:03','2025-08-01 20:52:03'),(9,4,'dashboard_layout','grid','string',0,'2025-08-01 20:52:03','2025-08-01 20:52:03'),(10,5,'dashboard_layout','grid','string',0,'2025-08-01 20:52:03','2025-08-01 20:52:03'),(11,6,'dashboard_layout','grid','string',0,'2025-08-01 20:52:03','2025-08-01 20:52:03'),(15,1,'notifications_enabled','1','bool',0,'2025-08-01 20:52:03','2025-08-01 20:52:03'),(16,4,'notifications_enabled','1','bool',0,'2025-08-01 20:52:03','2025-08-01 20:52:03'),(17,5,'notifications_enabled','1','bool',0,'2025-08-01 20:52:03','2025-08-01 20:52:03'),(18,6,'notifications_enabled','1','bool',0,'2025-08-01 20:52:03','2025-08-01 20:52:03');

--
-- Table structure for table `images_postees`
--

CREATE TABLE `images_postees` (
  `id` int NOT NULL AUTO_INCREMENT,
  `image_path` varchar(255) DEFAULT NULL,
  `reseau` varchar(50) DEFAULT 'manual',
  `post_id` int DEFAULT '0',
  `horodatage` datetime DEFAULT CURRENT_TIMESTAMP,
  `nom_fichier` varchar(255) DEFAULT NULL,
  `user_id` int DEFAULT '1',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `images_postees`
--


--
-- Table structure for table `instagram_old`
--

CREATE TABLE `instagram_old` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int DEFAULT NULL,
  `citation` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `post` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `image` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `hashtags` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `horodatage` datetime DEFAULT CURRENT_TIMESTAMP,
  `tokens_used` int DEFAULT '0',
  `media_type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT 'image',
  `ready_start` tinyint DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `fk_instagram_user` (`user_id`),
  CONSTRAINT `fk_instagram_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `instagram_old`
--


--
-- Table structure for table `linkedin_old`
--

CREATE TABLE `linkedin_old` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int DEFAULT NULL,
  `citation` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `post` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `image` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `hashtags` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `horodatage` datetime DEFAULT CURRENT_TIMESTAMP,
  `tokens_used` int DEFAULT '0',
  `media_type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT 'image',
  `ready_start` tinyint DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `fk_linkedin_user` (`user_id`),
  CONSTRAINT `fk_linkedin_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=60 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `linkedin_old`
--


--
-- Table structure for table `log_connexions`
--

CREATE TABLE `log_connexions` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int DEFAULT NULL,
  `ip` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `user_agent` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `logout_time` datetime DEFAULT NULL,
  `action` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `ip_address` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_log_user` (`user_id`),
  CONSTRAINT `fk_log_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=188 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `log_connexions`
--

INSERT INTO `log_connexions` VALUES (72,1,'57.128.183.39','curl/8.12.1','2025-07-12 14:40:35',NULL,'login',NULL),(73,5,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-16 20:58:44',NULL,'login',NULL),(74,5,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-16 21:04:46',NULL,'login',NULL),(75,5,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-16 22:55:03',NULL,'login',NULL),(76,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36','2025-07-17 11:41:49',NULL,'login',NULL),(77,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36','2025-07-17 12:21:28',NULL,'login',NULL),(78,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36','2025-07-17 12:33:17',NULL,'login',NULL),(79,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-17 13:08:17',NULL,'login',NULL),(80,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-17 13:16:55',NULL,'login',NULL),(81,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-17 13:58:31',NULL,'login',NULL),(82,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-17 14:04:52',NULL,'login',NULL),(83,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-17 14:05:53',NULL,'login',NULL),(84,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-17 14:06:18',NULL,'login',NULL),(85,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-17 14:09:35',NULL,'login',NULL),(86,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36','2025-07-17 14:13:01',NULL,'login',NULL),(87,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-17 14:18:35',NULL,'login',NULL),(88,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-17 14:24:31',NULL,'login',NULL),(89,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-17 14:25:36',NULL,'login',NULL),(90,5,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-17 14:32:11',NULL,'login',NULL),(91,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-17 14:53:46',NULL,'login',NULL),(92,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-17 14:56:20',NULL,'login',NULL),(93,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36','2025-07-17 15:04:58',NULL,'login',NULL),(94,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-17 15:16:09',NULL,'login',NULL),(95,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-17 15:56:51',NULL,'login',NULL),(96,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-17 16:05:15',NULL,'login',NULL),(97,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-17 20:30:07',NULL,'login',NULL),(98,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36','2025-07-18 05:33:30',NULL,'login',NULL),(99,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-18 06:17:14',NULL,'login',NULL),(100,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36','2025-07-18 06:51:27',NULL,'login',NULL),(101,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-18 07:39:32',NULL,'login',NULL),(102,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36','2025-07-18 09:03:34',NULL,'login',NULL),(103,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-18 09:07:59',NULL,'login',NULL),(104,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-18 09:33:26',NULL,'login',NULL),(105,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-18 11:48:42',NULL,'login',NULL),(106,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-18 12:40:56',NULL,'login',NULL),(107,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-18 12:46:14',NULL,'login',NULL),(108,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-18 13:45:01',NULL,'login',NULL),(109,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-18 14:33:50',NULL,'login',NULL),(110,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-18 15:50:38',NULL,'login',NULL),(111,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-18 21:04:13',NULL,'login',NULL),(112,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-18 21:14:13',NULL,'login',NULL),(113,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-18 22:04:20',NULL,'login',NULL),(114,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-18 22:37:20',NULL,'login',NULL),(115,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-19 06:03:40',NULL,'login',NULL),(116,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-19 06:12:40',NULL,'login',NULL),(117,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-19 11:46:19',NULL,'login',NULL),(118,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-19 12:32:20',NULL,'login',NULL),(119,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-19 12:50:38',NULL,'login',NULL),(120,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-19 14:41:52',NULL,'login',NULL),(121,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-19 15:20:35',NULL,'login',NULL),(122,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-19 15:42:11',NULL,'login',NULL),(123,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-19 21:54:56',NULL,'login',NULL),(124,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-20 07:03:04',NULL,'login',NULL),(125,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36','2025-07-20 07:45:07',NULL,'login',NULL),(126,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-20 08:02:54',NULL,'login',NULL),(127,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-20 11:54:11',NULL,'login',NULL),(128,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36','2025-07-20 15:13:40',NULL,'login',NULL),(129,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-20 15:18:58',NULL,'login',NULL),(130,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-20 20:15:33',NULL,'login',NULL),(131,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-20 20:31:45',NULL,'login',NULL),(132,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-20 20:56:13',NULL,'login',NULL),(133,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-20 20:56:35',NULL,'login',NULL),(134,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-20 21:14:27',NULL,'login',NULL),(135,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-20 22:01:08',NULL,'login',NULL),(136,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-20 22:28:49',NULL,'login',NULL),(137,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-21 05:58:30',NULL,'login',NULL),(138,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-21 06:51:38',NULL,'login',NULL),(139,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-21 07:48:11',NULL,'login',NULL),(140,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-21 08:04:01',NULL,'login',NULL),(141,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-21 09:08:55',NULL,'login',NULL),(142,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36','2025-07-21 09:12:27',NULL,'login',NULL),(143,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-21 09:43:22',NULL,'login',NULL),(144,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-21 11:50:33',NULL,'login',NULL),(145,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36','2025-07-21 12:00:15',NULL,'login',NULL),(146,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-21 12:17:51',NULL,'login',NULL),(147,4,'82.64.1.223','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36','2025-07-21 12:26:55',NULL,'login',NULL),(148,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-21 12:30:50',NULL,'login',NULL),(149,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-21 13:36:17',NULL,'login',NULL),(150,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-21 14:37:43',NULL,'login',NULL),(151,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-21 14:55:59',NULL,'login',NULL),(152,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-21 20:47:23',NULL,'login',NULL),(153,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-21 21:38:15',NULL,'login',NULL),(154,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-21 21:42:22',NULL,'login',NULL),(155,5,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-22 05:42:17',NULL,'login',NULL),(156,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-22 12:14:57',NULL,NULL,NULL),(157,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-22 12:40:19','2025-07-25 12:41:46',NULL,NULL),(158,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-22 12:40:46','2025-07-25 11:55:35',NULL,NULL),(159,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0','2025-07-22 12:41:38','2025-07-22 12:51:53',NULL,NULL),(160,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0','2025-07-29 13:13:25','2025-07-29 14:06:43','login',NULL),(161,9,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0','2025-07-29 15:00:34',NULL,'login',NULL),(162,9,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0','2025-07-29 15:00:55',NULL,'logout',NULL),(163,8,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0','2025-07-29 15:01:52',NULL,'login',NULL),(164,8,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0','2025-07-29 15:08:09',NULL,'logout',NULL),(165,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0','2025-07-29 15:24:20',NULL,'login',NULL),(166,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0','2025-07-29 15:24:23',NULL,'logout',NULL),(167,8,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0','2025-07-29 15:25:36',NULL,'login',NULL),(168,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0','2025-07-29 20:04:49',NULL,'login',NULL),(169,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0','2025-07-29 20:41:10',NULL,'logout',NULL),(170,9,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36','2025-07-30 08:29:19',NULL,'login',NULL),(171,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0','2025-07-30 09:39:41',NULL,'login',NULL),(172,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0','2025-07-30 09:40:42',NULL,'logout',NULL),(173,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0','2025-07-30 13:08:38',NULL,'login',NULL),(174,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0','2025-07-30 13:08:49',NULL,'logout',NULL),(175,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0','2025-07-30 13:10:00',NULL,'login',NULL),(176,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0','2025-07-30 13:36:08',NULL,'logout',NULL),(177,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0','2025-07-30 13:36:12',NULL,'login',NULL),(178,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0','2025-07-30 20:36:07',NULL,'login',NULL),(179,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0','2025-07-31 05:52:05',NULL,'login',NULL),(180,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0','2025-07-31 08:46:35',NULL,'login',NULL),(181,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0','2025-07-31 08:48:30',NULL,'login',NULL),(182,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0','2025-07-31 13:35:00',NULL,'login',NULL),(183,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0','2025-08-02 06:47:34',NULL,'login',NULL),(184,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0','2025-08-02 06:48:17',NULL,'login',NULL),(185,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0','2025-08-03 16:17:32',NULL,'login',NULL),(186,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0','2025-08-03 21:26:57',NULL,'login',NULL),(187,4,'82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0','2025-08-04 11:49:46',NULL,'login',NULL);

--
-- Table structure for table `log_emails`
--

CREATE TABLE `log_emails` (
  `id` int NOT NULL AUTO_INCREMENT,
  `to_email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `subject` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `body` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `sent_at` datetime DEFAULT CURRENT_TIMESTAMP,
  `status` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `error_message` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `log_emails`
--


--
-- Table structure for table `log_envoi`
--

CREATE TABLE `log_envoi` (
  `id` int NOT NULL AUTO_INCREMENT,
  `post_id` int NOT NULL,
  `reseau` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `date_envoi` datetime DEFAULT CURRENT_TIMESTAMP,
  `user_id` int DEFAULT NULL,
  `statut` enum('envoyé','erreur','en_attente','rejeté') COLLATE utf8mb4_unicode_ci DEFAULT 'en_attente',
  `response_code` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `response_message` text COLLATE utf8mb4_unicode_ci,
  `error_message` text COLLATE utf8mb4_unicode_ci,
  `external_id` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `log_envoi`
--


--
-- Table structure for table `log_envois`
--

CREATE TABLE `log_envois` (
  `id` int NOT NULL AUTO_INCREMENT,
  `reseau` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `post_id` int DEFAULT NULL,
  `contenu` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `horodatage` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `log_envois`
--


--
-- Table structure for table `log_ia`
--

CREATE TABLE `log_ia` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int DEFAULT NULL,
  `reseau` varchar(20) DEFAULT NULL,
  `theme` varchar(255) DEFAULT NULL,
  `result` text,
  `horodatage` datetime DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `user_id` (`user_id`),
  CONSTRAINT `log_ia_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 `log_ia`
--


--
-- Table structure for table `log_pdfs`
--

CREATE TABLE `log_pdfs` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int DEFAULT NULL,
  `reseau` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `post_id` int DEFAULT NULL,
  `pdf_filename` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `horodatage` datetime DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `log_pdfs`
--


--
-- Table structure for table `log_uploads`
--

CREATE TABLE `log_uploads` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int DEFAULT NULL,
  `filename` varchar(255) DEFAULT NULL,
  `filepath` text,
  `horodatage` datetime DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `user_id` (`user_id`),
  CONSTRAINT `log_uploads_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 `log_uploads`
--


--
-- Table structure for table `login_attempts`
--

CREATE TABLE `login_attempts` (
  `id` int NOT NULL AUTO_INCREMENT,
  `email` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `ip_address` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `user_agent` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `success` tinyint(1) NOT NULL DEFAULT '0',
  `failure_reason` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `attempted_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `email` (`email`),
  KEY `ip_address` (`ip_address`),
  KEY `attempted_at` (`attempted_at`)
) ENGINE=InnoDB AUTO_INCREMENT=76 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `login_attempts`
--

INSERT INTO `login_attempts` VALUES (9,'lefebfre.pierre@audiovizu.fr','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36',0,'invalid_credentials','2025-07-20 15:13:27'),(10,'lefebvre.pierre@audiovizu.fr','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36',0,'invalid_credentials','2025-07-21 09:12:19'),(11,'test@lala.fr','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0',0,'invalid_credentials','2025-07-22 05:42:28'),(12,'lefebvre.pierre@audiovizu.fr','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0',1,'login_success','2025-07-22 12:14:57'),(13,'lefebvre.pierre@audiovizu.fr','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0',1,'login_success','2025-07-22 12:40:19'),(14,'lefebvre.pierre@audiovizu.fr','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0',1,'login_success','2025-07-22 12:40:46'),(15,'lefebvre.pierre@audiovizu.fr','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0',1,'login_success','2025-07-22 12:41:38'),(16,'lefebvre.pierre@audiovizu.fr','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0',1,'success','2025-07-22 12:51:56'),(17,'lefebvre.pierre@audiovizu.fr','77.128.153.138','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0',1,'success','2025-07-22 20:48:46'),(18,'lefebvre.pierre@audiovizu.fr','77.128.153.138','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0',1,'success','2025-07-22 21:30:20'),(19,'lefebvre.pierre@audiovizu.fr','77.128.85.169','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0',1,'success','2025-07-23 06:01:42'),(20,'lefebvre.pierre@audiovizu.fr','77.128.85.228','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0',1,'success','2025-07-23 13:33:25'),(21,'lefebvre.pierre@audiovizu.fr','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0',1,'success','2025-07-24 22:20:38'),(22,'lefebvre.pierre@audiovizu.fr','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0',1,'success','2025-07-25 05:48:20'),(23,'lefebvre.pierre@audiovizu.fr','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0',1,'success','2025-07-25 09:26:49'),(24,'lefebvre.pierre@audiovizu.fr','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0',1,'success','2025-07-25 11:54:16'),(25,'lefebvre.pierre@audiovizu.fr','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0',1,'success','2025-07-25 12:41:25'),(26,'lefebvre.pierre@audiovizu.fr','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0',1,'success','2025-07-25 12:43:41'),(27,'test@smg.local','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0',0,'user_not_found','2025-07-25 14:40:09'),(28,'test@smg.fr','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0',1,'success','2025-07-25 14:40:33'),(29,'lefebvre.pierre@audiovizu.fr','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0',1,'success','2025-07-25 20:50:33'),(30,'lefebvre.pierre@audiovizu.fr','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0',1,'success','2025-07-26 08:28:12'),(31,'lefebvre.pierre@audiovizu.fr','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0',1,'success','2025-07-26 09:21:27'),(32,'lefebvre.pierre@audiovizu.fr','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0',1,'success','2025-07-26 12:12:24'),(33,'lefebvre.pierre@audiovizu.fr','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0',1,'success','2025-07-26 13:12:51'),(34,'lefebvre.pierre@audiovizu.fr','77.128.85.26','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36',1,'success','2025-07-26 16:58:58'),(35,'lefebvre.pierre@audiovizu.fr','77.128.85.26','Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36',1,'success','2025-07-26 17:31:26'),(36,'lefebvre.pierre@audiovizu.fr','77.128.85.140','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0',1,'success','2025-07-26 22:59:44'),(37,'lefebvre.pierre@audiovizu.fr','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0',1,'success','2025-07-27 13:45:21'),(38,'lefebvre.pierre@audiovizu.fr','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0',1,'success','2025-07-27 14:40:32'),(39,'lefebvre.pierre@audiovizu.fr','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0',1,'success','2025-07-27 21:39:00'),(40,'lefebvre.pierre@audiovizu.fr','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0',1,'success','2025-07-28 07:54:46'),(41,'lefebvre.pierre@audiovizu.fr','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0',1,'success','2025-07-28 12:28:36'),(42,'lefebvre.pierre@audiovizu.fr','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0',1,'success','2025-07-28 12:55:13'),(43,'lefebvre.pierre@audiovizu.fr','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0',1,'success','2025-07-28 14:05:51'),(44,'lefebvre.pierre@audiovizu.fr','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0',1,'success','2025-07-28 14:16:11'),(45,'lefebvre.pierre@audiovizu.fr','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0',1,'success','2025-07-28 14:37:46'),(46,'lefebvre.pierre@audiovizu.fr','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36',1,'success','2025-07-28 15:10:08'),(47,'lefebvre.pierre@audiovizu.fr','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0',1,'success','2025-07-28 15:17:13'),(48,'lefevre.pierre@audiovizu.fr','176.132.79.74','Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36 OPR/119.0.0.0',0,'user_not_found','2025-07-28 17:30:52'),(49,'lefebvre.pierre@audiovizu.fr','176.132.79.74','Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36 OPR/119.0.0.0',0,'wrong_password','2025-07-28 17:31:55'),(50,'lefebvre.pierre@audiovizu.fr','176.132.79.74','Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36 OPR/119.0.0.0',1,'success','2025-07-28 17:32:22'),(51,'lefebvre.pierre@audiovizu.fr','176.132.79.74','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36',0,'wrong_password','2025-07-28 17:41:02'),(52,'lefebvre.pierre@audiovizu.fr','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0',1,'Login successful','2025-07-29 13:13:25'),(53,'lefebvre.pierre@audiovizu.fr','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0',1,'success','2025-07-29 14:07:07'),(54,'episottevillaise@gmail.com','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0',1,'Login successful','2025-07-29 15:00:34'),(55,'ghislaine.gil@wanadoo.fr','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0',1,'Login successful','2025-07-29 15:01:52'),(56,'lefebvre.pierre@audiovizu.fr','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0',1,'Login successful','2025-07-29 15:24:20'),(57,'ghislaine.gil@wanadoo.fr','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0',1,'Login successful','2025-07-29 15:25:36'),(58,'lefebvre.pierre@audiovizu.fr','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0',1,'success','2025-07-29 16:51:56'),(59,'lefebvre.pierre@audiovizu.fr','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0',1,'success','2025-07-29 19:32:19'),(60,'lefebvre.pierre@audiovizu.fr','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0',1,'Login successful','2025-07-29 20:04:49'),(61,'episottevillaise@gmail.com','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36',1,'Login successful','2025-07-30 08:29:19'),(62,'lefebvre.pierre@audiovizu.fr','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0',1,'Login successful','2025-07-30 09:39:41'),(63,'lefebvre.pierre@audiovizu.fr','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0',1,'Login successful','2025-07-30 13:08:38'),(64,'lefebvre.pierre@audiovizu.fr','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0',1,'Login successful','2025-07-30 13:10:00'),(65,'lefebvre.pierre@audiovizu.fr','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0',1,'Login successful','2025-07-30 13:36:12'),(66,'lefebvre.pierre@audiovizu.fr','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0',1,'Login successful','2025-07-30 20:36:07'),(67,'lefebvre.pierre@audiovizu.fr','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0',1,'Login successful','2025-07-31 05:52:05'),(68,'lefebvre.pierre@audiovizu.fr','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0',1,'Login successful','2025-07-31 08:46:35'),(69,'lefebvre.pierre@audiovizu.fr','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0',1,'Login successful','2025-07-31 08:48:30'),(70,'lefebvre.pierre@audiovizu.fr','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0',1,'Login successful','2025-07-31 13:35:00'),(71,'lefebvre.pierre@audiovizu.fr','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0',1,'Login successful','2025-08-02 06:47:34'),(72,'lefebvre.pierre@audiovizu.fr','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0',1,'Login successful','2025-08-02 06:48:17'),(73,'lefebvre.pierre@audiovizu.fr','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0',1,'Login successful','2025-08-03 16:17:32'),(74,'lefebvre.pierre@audiovizu.fr','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0',1,'Login successful','2025-08-03 21:26:57'),(75,'lefebvre.pierre@audiovizu.fr','82.64.1.223','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0',1,'Login successful','2025-08-04 11:49:46');

--
-- Table structure for table `media_files`
--

CREATE TABLE `media_files` (
  `id` int NOT NULL AUTO_INCREMENT,
  `post_id` int DEFAULT NULL,
  `project_id` int NOT NULL,
  `user_id` int NOT NULL,
  `filename` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `original_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `file_path` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `file_type` enum('image','video','document','audio') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `mime_type` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `file_size` bigint DEFAULT NULL,
  `width` int DEFAULT NULL,
  `height` int DEFAULT NULL,
  `duration` int DEFAULT NULL,
  `thumbnail_path` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `alt_text` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `metadata` json DEFAULT NULL,
  `storage_provider` enum('local','aws_s3','google_cloud','azure') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT 'local',
  `storage_path` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `status` enum('uploading','processing','ready','error','deleted') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT 'ready',
  `created_at` datetime DEFAULT CURRENT_TIMESTAMP,
  `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `deleted_at` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_media_files_post_id` (`post_id`),
  KEY `idx_media_files_project_id` (`project_id`),
  KEY `idx_media_files_user_id` (`user_id`),
  KEY `idx_media_files_file_type` (`file_type`),
  KEY `idx_media_files_status` (`status`),
  KEY `idx_media_files_created_at` (`created_at`),
  CONSTRAINT `media_files_ibfk_1` FOREIGN KEY (`post_id`) REFERENCES `posts` (`id`) ON DELETE CASCADE,
  CONSTRAINT `media_files_ibfk_2` FOREIGN KEY (`project_id`) REFERENCES `projects` (`id`) ON DELETE CASCADE,
  CONSTRAINT `media_files_ibfk_3` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `media_files`
--


--
-- Table structure for table `media_library`
--

CREATE TABLE `media_library` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int NOT NULL,
  `client_id` int DEFAULT NULL,
  `filename` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `original_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `file_path` varchar(500) COLLATE utf8mb4_unicode_ci NOT NULL,
  `file_size` bigint NOT NULL,
  `mime_type` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `file_type` enum('image','video','audio','document') COLLATE utf8mb4_unicode_ci NOT NULL,
  `dimensions` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `duration` int DEFAULT NULL,
  `alt_text` text COLLATE utf8mb4_unicode_ci,
  `description` text COLLATE utf8mb4_unicode_ci,
  `tags` json DEFAULT NULL,
  `status` enum('active','deleted') COLLATE utf8mb4_unicode_ci DEFAULT 'active',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_user_id` (`user_id`),
  KEY `idx_client_id` (`client_id`),
  KEY `idx_file_type` (`file_type`),
  KEY `idx_status` (`status`),
  CONSTRAINT `media_library_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE RESTRICT,
  CONSTRAINT `media_library_ibfk_2` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `media_library`
--


--
-- Table structure for table `media_logs`
--

CREATE TABLE `media_logs` (
  `id` int NOT NULL AUTO_INCREMENT,
  `reseau` varchar(50) NOT NULL,
  `fichier_origine` varchar(255) NOT NULL,
  `fichier_converti` varchar(255) DEFAULT NULL,
  `taille_origine` int DEFAULT NULL,
  `taille_finale` int DEFAULT NULL,
  `duree_detectee` float DEFAULT NULL,
  `largeur` int DEFAULT NULL,
  `hauteur` int DEFAULT NULL,
  `statut` varchar(50) DEFAULT 'uploadé',
  `horodatage` datetime DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `media_logs`
--


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

CREATE TABLE `notifications` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int NOT NULL,
  `type` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `message` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `data` json DEFAULT NULL,
  `is_read` tinyint(1) DEFAULT '0',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `user_id` (`user_id`),
  CONSTRAINT `notifications_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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


--
-- Table structure for table `post_medias`
--

CREATE TABLE `post_medias` (
  `id` int NOT NULL AUTO_INCREMENT,
  `post_id` int NOT NULL,
  `media_path` varchar(500) COLLATE utf8mb4_unicode_ci NOT NULL,
  `media_type` enum('image','video') COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `media_source` enum('upload','workflow','external') COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `display_order` int DEFAULT '0',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `post_medias`
--


--
-- Table structure for table `post_networks`
--

CREATE TABLE `post_networks` (
  `id` int NOT NULL AUTO_INCREMENT,
  `post_id` int NOT NULL,
  `network` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `is_active` tinyint(1) DEFAULT '1',
  `format_settings` json DEFAULT NULL,
  `export_status` enum('pending','processing','completed','failed') COLLATE utf8mb4_unicode_ci DEFAULT 'pending',
  `export_path` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `published_at` timestamp NULL DEFAULT NULL,
  `platform_post_id` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `engagement_data` json DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `unique_post_network` (`post_id`,`network`),
  KEY `fk_post_networks_platform` (`network`),
  CONSTRAINT `fk_post_networks_platform` FOREIGN KEY (`network`) REFERENCES `social_platforms` (`name`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=49 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `post_networks`
--

INSERT INTO `post_networks` VALUES (1,7,'instagram',1,NULL,'pending',NULL,NULL,NULL,NULL,'2025-07-25 06:21:19','2025-07-25 06:21:19'),(2,7,'facebook',1,NULL,'pending',NULL,NULL,NULL,NULL,'2025-07-25 06:21:19','2025-07-25 06:21:19'),(3,7,'linkedin',1,NULL,'pending',NULL,NULL,NULL,NULL,'2025-07-25 06:21:19','2025-07-25 06:21:19'),(4,8,'instagram',1,NULL,'pending',NULL,NULL,NULL,NULL,'2025-07-25 09:26:35','2025-07-25 09:26:35'),(5,8,'facebook',1,NULL,'pending',NULL,NULL,NULL,NULL,'2025-07-25 09:26:35','2025-07-25 09:26:35'),(6,8,'twitter',1,NULL,'pending',NULL,NULL,NULL,NULL,'2025-07-25 09:26:35','2025-07-25 09:26:35'),(7,9,'instagram',1,NULL,'pending',NULL,NULL,NULL,NULL,'2025-07-25 09:26:35','2025-07-25 09:26:35'),(8,9,'facebook',1,NULL,'pending',NULL,NULL,NULL,NULL,'2025-07-25 09:26:35','2025-07-25 09:26:35'),(9,9,'twitter',1,NULL,'pending',NULL,NULL,NULL,NULL,'2025-07-25 09:26:35','2025-07-25 09:26:35'),(10,10,'instagram',1,NULL,'pending',NULL,NULL,NULL,NULL,'2025-07-25 09:26:35','2025-07-25 09:26:35'),(11,10,'facebook',1,NULL,'pending',NULL,NULL,NULL,NULL,'2025-07-25 09:26:35','2025-07-25 09:26:35'),(12,10,'twitter',1,NULL,'pending',NULL,NULL,NULL,NULL,'2025-07-25 09:26:35','2025-07-25 09:26:35'),(13,11,'instagram',1,NULL,'pending',NULL,NULL,NULL,NULL,'2025-07-25 14:28:03','2025-07-25 14:28:03'),(14,11,'facebook',1,NULL,'pending',NULL,NULL,NULL,NULL,'2025-07-25 14:28:03','2025-07-25 14:28:03'),(15,11,'twitter',1,NULL,'pending',NULL,NULL,NULL,NULL,'2025-07-25 14:28:03','2025-07-25 14:28:03'),(16,12,'instagram',1,NULL,'pending',NULL,NULL,NULL,NULL,'2025-07-25 14:28:03','2025-07-25 14:28:03'),(17,12,'facebook',1,NULL,'pending',NULL,NULL,NULL,NULL,'2025-07-25 14:28:03','2025-07-25 14:28:03'),(18,12,'twitter',1,NULL,'pending',NULL,NULL,NULL,NULL,'2025-07-25 14:28:03','2025-07-25 14:28:03'),(19,13,'instagram',1,NULL,'pending',NULL,NULL,NULL,NULL,'2025-07-25 14:28:03','2025-07-25 14:28:03'),(20,13,'facebook',1,NULL,'pending',NULL,NULL,NULL,NULL,'2025-07-25 14:28:03','2025-07-25 14:28:03'),(21,13,'twitter',1,NULL,'pending',NULL,NULL,NULL,NULL,'2025-07-25 14:28:03','2025-07-25 14:28:03'),(22,14,'instagram',1,NULL,'pending',NULL,NULL,NULL,NULL,'2025-07-26 08:27:51','2025-07-26 08:27:51'),(23,14,'facebook',1,NULL,'pending',NULL,NULL,NULL,NULL,'2025-07-26 08:27:51','2025-07-26 08:27:51'),(24,14,'twitter',1,NULL,'pending',NULL,NULL,NULL,NULL,'2025-07-26 08:27:51','2025-07-26 08:27:51'),(25,15,'instagram',1,NULL,'pending',NULL,NULL,NULL,NULL,'2025-07-26 08:27:51','2025-07-26 08:27:51'),(26,15,'facebook',1,NULL,'pending',NULL,NULL,NULL,NULL,'2025-07-26 08:27:51','2025-07-26 08:27:51'),(27,15,'twitter',1,NULL,'pending',NULL,NULL,NULL,NULL,'2025-07-26 08:27:51','2025-07-26 08:27:51'),(28,16,'instagram',1,NULL,'pending',NULL,NULL,NULL,NULL,'2025-07-26 08:27:51','2025-07-26 08:27:51'),(29,16,'facebook',1,NULL,'pending',NULL,NULL,NULL,NULL,'2025-07-26 08:27:51','2025-07-26 08:27:51'),(30,16,'twitter',1,NULL,'pending',NULL,NULL,NULL,NULL,'2025-07-26 08:27:51','2025-07-26 08:27:51'),(31,17,'instagram',1,NULL,'pending',NULL,NULL,NULL,NULL,'2025-07-27 13:44:50','2025-07-27 13:44:50'),(32,17,'facebook',1,NULL,'pending',NULL,NULL,NULL,NULL,'2025-07-27 13:44:50','2025-07-27 13:44:50'),(33,17,'twitter',1,NULL,'pending',NULL,NULL,NULL,NULL,'2025-07-27 13:44:50','2025-07-27 13:44:50'),(34,18,'instagram',1,NULL,'pending',NULL,NULL,NULL,NULL,'2025-07-27 13:44:50','2025-07-27 13:44:50'),(35,18,'facebook',1,NULL,'pending',NULL,NULL,NULL,NULL,'2025-07-27 13:44:50','2025-07-27 13:44:50'),(36,18,'twitter',1,NULL,'pending',NULL,NULL,NULL,NULL,'2025-07-27 13:44:50','2025-07-27 13:44:50'),(37,19,'instagram',1,NULL,'pending',NULL,NULL,NULL,NULL,'2025-07-27 13:44:50','2025-07-27 13:44:50'),(38,19,'facebook',1,NULL,'pending',NULL,NULL,NULL,NULL,'2025-07-27 13:44:50','2025-07-27 13:44:50'),(39,19,'twitter',1,NULL,'pending',NULL,NULL,NULL,NULL,'2025-07-27 13:44:50','2025-07-27 13:44:50'),(40,20,'instagram',1,NULL,'pending',NULL,NULL,NULL,NULL,'2025-07-29 14:07:13','2025-07-29 14:07:13'),(41,20,'facebook',1,NULL,'pending',NULL,NULL,NULL,NULL,'2025-07-29 14:07:13','2025-07-29 14:07:13'),(42,20,'twitter',1,NULL,'pending',NULL,NULL,NULL,NULL,'2025-07-29 14:07:13','2025-07-29 14:07:13'),(43,21,'instagram',1,NULL,'pending',NULL,NULL,NULL,NULL,'2025-07-29 14:07:13','2025-07-29 14:07:13'),(44,21,'facebook',1,NULL,'pending',NULL,NULL,NULL,NULL,'2025-07-29 14:07:13','2025-07-29 14:07:13'),(45,21,'twitter',1,NULL,'pending',NULL,NULL,NULL,NULL,'2025-07-29 14:07:13','2025-07-29 14:07:13'),(46,22,'instagram',1,NULL,'pending',NULL,NULL,NULL,NULL,'2025-07-29 14:07:13','2025-07-29 14:07:13'),(47,22,'facebook',1,NULL,'pending',NULL,NULL,NULL,NULL,'2025-07-29 14:07:13','2025-07-29 14:07:13'),(48,22,'twitter',1,NULL,'pending',NULL,NULL,NULL,NULL,'2025-07-29 14:07:13','2025-07-29 14:07:13');

--
-- Table structure for table `posts`
--

CREATE TABLE `posts` (
  `id` int NOT NULL AUTO_INCREMENT,
  `client_id` int DEFAULT NULL,
  `user_id` int NOT NULL,
  `reseau` enum('instagram','facebook','twitter','linkedin','snapchat','tiktok','youtube') COLLATE utf8mb4_unicode_ci NOT NULL,
  `titre` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `contenu` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `hashtags` text COLLATE utf8mb4_unicode_ci,
  `media_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `media_type` enum('image','video','carousel','story') COLLATE utf8mb4_unicode_ci DEFAULT 'image',
  `created_at` datetime DEFAULT CURRENT_TIMESTAMP,
  `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `scheduled_at` datetime DEFAULT NULL,
  `published_at` timestamp NULL DEFAULT NULL,
  `statut` enum('draft','scheduled','published','failed','cancelled') COLLATE utf8mb4_unicode_ci DEFAULT 'draft',
  `type` enum('text','image','video','carousel','story') COLLATE utf8mb4_unicode_ci DEFAULT 'text',
  `priority` enum('low','normal','high') COLLATE utf8mb4_unicode_ci DEFAULT 'normal',
  `engagement_rate` decimal(5,2) DEFAULT '0.00',
  `likes_count` int DEFAULT '0',
  `comments_count` int DEFAULT '0',
  `shares_count` int DEFAULT '0',
  `reach_count` int DEFAULT '0',
  `link_url` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `multi_network` tinyint(1) DEFAULT '0' COMMENT 'Post pour plusieurs réseaux',
  `primary_network` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Réseau principal',
  `max_photos` int DEFAULT '5' COMMENT 'Limite photos par post',
  `max_videos` int DEFAULT '1' COMMENT 'Limite vidéos par post',
  `ai_generated` tinyint(1) DEFAULT '0' COMMENT 'Contenu généré par IA',
  `ai_profile_used` int DEFAULT NULL COMMENT 'Profil IA utilisé',
  `ai_prompt_used` text COLLATE utf8mb4_unicode_ci COMMENT 'Prompt utilisé',
  `ai_tokens_used` int DEFAULT '0' COMMENT 'Tokens consommés',
  `ai_confidence_score` decimal(3,2) DEFAULT NULL COMMENT 'Score qualité IA 0-1',
  `ai_suggestions` json DEFAULT NULL COMMENT 'Suggestions IA stockées',
  `ai_generation_time` timestamp NULL DEFAULT NULL COMMENT 'Quand généré',
  PRIMARY KEY (`id`),
  KEY `client_id` (`client_id`),
  KEY `user_id` (`user_id`),
  KEY `idx_posts_user_status` (`user_id`,`statut`),
  KEY `idx_posts_reseau_scheduled` (`reseau`,`scheduled_at`),
  KEY `idx_posts_ai_generated` (`ai_generated`,`ai_profile_used`),
  KEY `idx_posts_ai_tokens` (`ai_tokens_used`),
  KEY `idx_posts_ai_score` (`ai_confidence_score`),
  KEY `fk_posts_ai_profile` (`ai_profile_used`),
  CONSTRAINT `fk_posts_ai_profile` FOREIGN KEY (`ai_profile_used`) REFERENCES `user_ai_profiles` (`id`) ON DELETE SET NULL,
  CONSTRAINT `posts_ibfk_1` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE,
  CONSTRAINT `posts_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `posts`
--

INSERT INTO `posts` VALUES (7,NULL,6,'instagram','Post test SMG Studio FIXED','Ceci est un post de test CORRIGÉ pour vérifier que le dashboard fonctionne.','#test #smg #fixed',NULL,'image','2025-07-25 06:21:19','2025-07-25 06:21:19',NULL,NULL,'draft','text','normal',0.00,0,0,0,0,NULL,0,NULL,5,1,0,NULL,NULL,0,NULL,NULL,NULL),(8,NULL,4,'instagram','🚑 Post Recovery Test #1','Premier post créé après recovery SMG Studio v2.0. Système opérationnel !','#SMGStudio #Recovery #Test #SocialMedia #Papy77',NULL,'image','2025-07-25 09:26:35','2025-07-25 09:26:35',NULL,NULL,'draft','text','normal',0.00,0,0,0,0,NULL,0,NULL,5,1,0,NULL,NULL,0,NULL,NULL,NULL),(9,NULL,4,'instagram','📱 Multi-Network Test #2','Test de post multi-réseaux avec programmation. Instagram + Facebook + Twitter ready !','#MultiNetwork #Instagram #Facebook #Twitter #SMG',NULL,'image','2025-07-25 09:26:35','2025-07-25 09:26:35',NULL,NULL,'draft','text','normal',0.00,0,0,0,0,NULL,0,NULL,5,1,0,NULL,NULL,0,NULL,NULL,NULL),(10,NULL,4,'instagram','🎯 Workflow Validation #3','Validation complète du workflow SMG Studio. Upload → Post → Schedule → Publish. All systems GO !','#Workflow #Validation #SMGStudio #AllSystemsGO',NULL,'image','2025-07-25 09:26:35','2025-07-25 09:26:35',NULL,NULL,'draft','text','normal',0.00,0,0,0,0,NULL,0,NULL,5,1,0,NULL,NULL,0,NULL,NULL,NULL),(11,NULL,4,'instagram','🚑 Post Recovery Test #1','Premier post créé après recovery SMG Studio v2.0. Système opérationnel !','#SMGStudio #Recovery #Test #SocialMedia #Papy77',NULL,'image','2025-07-25 14:28:03','2025-07-25 14:28:03',NULL,NULL,'draft','text','normal',0.00,0,0,0,0,NULL,0,NULL,5,1,0,NULL,NULL,0,NULL,NULL,NULL),(12,NULL,4,'instagram','📱 Multi-Network Test #2','Test de post multi-réseaux avec programmation. Instagram + Facebook + Twitter ready !','#MultiNetwork #Instagram #Facebook #Twitter #SMG',NULL,'image','2025-07-25 14:28:03','2025-07-25 14:28:03',NULL,NULL,'draft','text','normal',0.00,0,0,0,0,NULL,0,NULL,5,1,0,NULL,NULL,0,NULL,NULL,NULL),(13,NULL,4,'instagram','🎯 Workflow Validation #3','Validation complète du workflow SMG Studio. Upload → Post → Schedule → Publish. All systems GO !','#Workflow #Validation #SMGStudio #AllSystemsGO',NULL,'image','2025-07-25 14:28:03','2025-07-25 14:28:03',NULL,NULL,'draft','text','normal',0.00,0,0,0,0,NULL,0,NULL,5,1,0,NULL,NULL,0,NULL,NULL,NULL),(14,NULL,4,'instagram','🚑 Post Recovery Test #1','Premier post créé après recovery SMG Studio v2.0. Système opérationnel !','#SMGStudio #Recovery #Test #SocialMedia #Papy77',NULL,'image','2025-07-26 08:27:51','2025-07-26 08:27:51',NULL,NULL,'draft','text','normal',0.00,0,0,0,0,NULL,0,NULL,5,1,0,NULL,NULL,0,NULL,NULL,NULL),(15,NULL,4,'instagram','📱 Multi-Network Test #2','Test de post multi-réseaux avec programmation. Instagram + Facebook + Twitter ready !','#MultiNetwork #Instagram #Facebook #Twitter #SMG',NULL,'image','2025-07-26 08:27:51','2025-07-26 08:27:51',NULL,NULL,'draft','text','normal',0.00,0,0,0,0,NULL,0,NULL,5,1,0,NULL,NULL,0,NULL,NULL,NULL),(16,NULL,4,'instagram','🎯 Workflow Validation #3','Validation complète du workflow SMG Studio. Upload → Post → Schedule → Publish. All systems GO !','#Workflow #Validation #SMGStudio #AllSystemsGO',NULL,'image','2025-07-26 08:27:51','2025-07-26 08:27:51',NULL,NULL,'draft','text','normal',0.00,0,0,0,0,NULL,0,NULL,5,1,0,NULL,NULL,0,NULL,NULL,NULL),(17,NULL,4,'instagram','🚑 Post Recovery Test #1','Premier post créé après recovery SMG Studio v2.0. Système opérationnel !','#SMGStudio #Recovery #Test #SocialMedia #Papy77',NULL,'image','2025-07-27 13:44:50','2025-07-27 13:44:50',NULL,NULL,'draft','text','normal',0.00,0,0,0,0,NULL,0,NULL,5,1,0,NULL,NULL,0,NULL,NULL,NULL),(18,NULL,4,'instagram','📱 Multi-Network Test #2','Test de post multi-réseaux avec programmation. Instagram + Facebook + Twitter ready !','#MultiNetwork #Instagram #Facebook #Twitter #SMG',NULL,'image','2025-07-27 13:44:50','2025-07-27 13:44:50',NULL,NULL,'draft','text','normal',0.00,0,0,0,0,NULL,0,NULL,5,1,0,NULL,NULL,0,NULL,NULL,NULL),(19,NULL,4,'instagram','🎯 Workflow Validation #3','Validation complète du workflow SMG Studio. Upload → Post → Schedule → Publish. All systems GO !','#Workflow #Validation #SMGStudio #AllSystemsGO',NULL,'image','2025-07-27 13:44:50','2025-07-27 13:44:50',NULL,NULL,'draft','text','normal',0.00,0,0,0,0,NULL,0,NULL,5,1,0,NULL,NULL,0,NULL,NULL,NULL),(20,NULL,4,'instagram','🚑 Post Recovery Test #1','Premier post créé après recovery SMG Studio v2.0. Système opérationnel !','#SMGStudio #Recovery #Test #SocialMedia #Papy77',NULL,'image','2025-07-29 14:07:13','2025-07-29 14:07:13',NULL,NULL,'draft','text','normal',0.00,0,0,0,0,NULL,0,NULL,5,1,0,NULL,NULL,0,NULL,NULL,NULL),(21,NULL,4,'instagram','📱 Multi-Network Test #2','Test de post multi-réseaux avec programmation. Instagram + Facebook + Twitter ready !','#MultiNetwork #Instagram #Facebook #Twitter #SMG',NULL,'image','2025-07-29 14:07:13','2025-07-29 14:07:13',NULL,NULL,'draft','text','normal',0.00,0,0,0,0,NULL,0,NULL,5,1,0,NULL,NULL,0,NULL,NULL,NULL),(22,NULL,4,'instagram','🎯 Workflow Validation #3','Validation complète du workflow SMG Studio. Upload → Post → Schedule → Publish. All systems GO !','#Workflow #Validation #SMGStudio #AllSystemsGO',NULL,'image','2025-07-29 14:07:13','2025-07-29 14:07:13',NULL,NULL,'draft','text','normal',0.00,0,0,0,0,NULL,0,NULL,5,1,0,NULL,NULL,0,NULL,NULL,NULL);

--
-- Table structure for table `posts_pdf_log`
--

CREATE TABLE `posts_pdf_log` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int DEFAULT NULL,
  `reseau` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `post_id` int DEFAULT NULL,
  `pdf_filename` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `horodatage` datetime DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `posts_pdf_log`
--


--
-- Table structure for table `project_users`
--

CREATE TABLE `project_users` (
  `id` int NOT NULL AUTO_INCREMENT,
  `project_id` int NOT NULL,
  `user_id` int NOT NULL,
  `role` enum('owner','editor','viewer','collaborator') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT 'viewer',
  `permissions` json DEFAULT NULL,
  `notifications` json DEFAULT NULL,
  `assigned_at` datetime DEFAULT CURRENT_TIMESTAMP,
  `assigned_by` int NOT NULL,
  `last_activity` datetime DEFAULT NULL,
  `status` enum('active','inactive') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT 'active',
  PRIMARY KEY (`id`),
  UNIQUE KEY `unique_project_user` (`project_id`,`user_id`),
  KEY `idx_project_users_user_id` (`user_id`),
  KEY `idx_project_users_assigned_by` (`assigned_by`),
  KEY `idx_project_users_role` (`role`),
  KEY `idx_project_users_status` (`status`),
  CONSTRAINT `project_users_ibfk_1` FOREIGN KEY (`project_id`) REFERENCES `projects` (`id`) ON DELETE CASCADE,
  CONSTRAINT `project_users_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  CONSTRAINT `project_users_ibfk_3` FOREIGN KEY (`assigned_by`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `project_users`
--


--
-- Table structure for table `projects`
--

CREATE TABLE `projects` (
  `id` int NOT NULL AUTO_INCREMENT,
  `nom` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `client_id` int NOT NULL,
  `created_by` int NOT NULL,
  `status` enum('active','archived','paused','completed') COLLATE utf8mb4_unicode_ci DEFAULT 'active',
  `priority` enum('low','medium','high','urgent') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT 'medium',
  `start_date` date DEFAULT NULL,
  `end_date` date DEFAULT NULL,
  `budget` decimal(10,2) DEFAULT NULL,
  `currency` varchar(3) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT 'EUR',
  `progress` int DEFAULT '0',
  `settings` json DEFAULT NULL,
  `tags` json DEFAULT NULL,
  `created_at` datetime DEFAULT CURRENT_TIMESTAMP,
  `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `deleted_at` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_projects_client_id` (`client_id`),
  KEY `idx_projects_created_by` (`created_by`),
  KEY `idx_projects_status` (`status`),
  KEY `idx_projects_priority` (`priority`),
  KEY `idx_projects_start_date` (`start_date`),
  CONSTRAINT `projects_ibfk_1` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE,
  CONSTRAINT `projects_ibfk_2` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `projects`
--


--
-- Table structure for table `resosociaux`
--

CREATE TABLE `resosociaux` (
  `id` int NOT NULL AUTO_INCREMENT,
  `nom` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `max_image_width` int DEFAULT '1080',
  `max_image_height` int DEFAULT '1080',
  `max_video_duration` int DEFAULT '60',
  `max_file_size` int DEFAULT '5242880',
  `accepted_formats` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `ratio` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `commentaire` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `resosociaux`
--


--
-- Table structure for table `scheduled_jobs`
--

CREATE TABLE `scheduled_jobs` (
  `id` int NOT NULL AUTO_INCREMENT,
  `job_type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `entity_type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `entity_id` int DEFAULT NULL,
  `user_id` int DEFAULT NULL,
  `project_id` int DEFAULT NULL,
  `scheduled_at` datetime NOT NULL,
  `executed_at` datetime DEFAULT NULL,
  `status` enum('pending','running','completed','failed','cancelled') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT 'pending',
  `attempts` int DEFAULT '0',
  `max_attempts` int DEFAULT '3',
  `payload` json DEFAULT NULL,
  `result` json DEFAULT NULL,
  `error_message` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `created_at` datetime DEFAULT CURRENT_TIMESTAMP,
  `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_jobs_scheduled_at` (`scheduled_at`),
  KEY `idx_jobs_status` (`status`),
  KEY `idx_jobs_type` (`job_type`),
  KEY `idx_jobs_entity` (`entity_type`,`entity_id`),
  KEY `idx_jobs_user_id` (`user_id`),
  KEY `idx_jobs_project_id` (`project_id`),
  CONSTRAINT `scheduled_jobs_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  CONSTRAINT `scheduled_jobs_ibfk_2` FOREIGN KEY (`project_id`) REFERENCES `projects` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `scheduled_jobs`
--


--
-- Table structure for table `scheduled_posts`
--

CREATE TABLE `scheduled_posts` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int NOT NULL,
  `post_id` int NOT NULL,
  `network` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `scheduled_datetime` datetime NOT NULL,
  `status` enum('pending','processing','sent','failed') COLLATE utf8mb4_unicode_ci DEFAULT 'pending',
  `priority` int DEFAULT '1',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `processed_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_user_schedule` (`user_id`,`scheduled_datetime`),
  KEY `idx_status_schedule` (`status`,`scheduled_datetime`),
  KEY `post_id` (`post_id`),
  CONSTRAINT `scheduled_posts_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`),
  CONSTRAINT `scheduled_posts_ibfk_2` FOREIGN KEY (`post_id`) REFERENCES `posts` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `scheduled_posts`
--


--
-- Table structure for table `security_logs`
--

CREATE TABLE `security_logs` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int DEFAULT NULL,
  `action` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `platform` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `ip_address` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `user_agent` text COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `user_id` (`user_id`),
  CONSTRAINT `security_logs_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `security_logs`
--


--
-- Table structure for table `settings`
--

CREATE TABLE `settings` (
  `id` int NOT NULL AUTO_INCREMENT,
  `client_id` int NOT NULL,
  `logo_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `header_text` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `footer_text` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `css_theme` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT 'shopinet.css',
  `email_contact` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `phone_contact` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `company_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `ia_enabled` tinyint(1) DEFAULT '1',
  `networks_enabled` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `created_at` datetime DEFAULT CURRENT_TIMESTAMP,
  `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `client_id` (`client_id`),
  CONSTRAINT `settings_ibfk_1` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `settings`
--


--
-- Table structure for table `social_export_formats`
--

CREATE TABLE `social_export_formats` (
  `id` int NOT NULL AUTO_INCREMENT,
  `network_name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `format_name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `resolution_width` int NOT NULL,
  `resolution_height` int NOT NULL,
  `max_duration` int DEFAULT '60',
  `max_file_size` bigint DEFAULT '104857600',
  `recommended_fps` int DEFAULT '30',
  `recommended_bitrate` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT '2M',
  `aspect_ratio` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `is_active` tinyint(1) DEFAULT '1',
  PRIMARY KEY (`id`),
  KEY `idx_network` (`network_name`),
  KEY `idx_active` (`is_active`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `social_export_formats`
--

INSERT INTO `social_export_formats` VALUES (1,'youtube','YouTube Standard',1920,1080,0,268435456,30,'5M','16:9','Format standard YouTube HD',1),(2,'youtube','YouTube Short',1080,1920,60,104857600,30,'3M','9:16','YouTube Shorts vertical',1),(3,'instagram','Instagram Post',1080,1080,60,104857600,30,'3M','1:1','Publication Instagram carrée',1),(4,'instagram','Instagram Story',1080,1920,15,52428800,30,'2M','9:16','Story Instagram verticale',1),(5,'instagram','Instagram Reel',1080,1920,90,104857600,30,'3M','9:16','Reel Instagram',1),(6,'tiktok','TikTok Standard',1080,1920,180,104857600,30,'3M','9:16','TikTok vertical standard',1),(7,'facebook','Facebook Post',1920,1080,0,268435456,30,'4M','16:9','Publication Facebook',1),(8,'facebook','Facebook Story',1080,1920,20,52428800,30,'2M','9:16','Story Facebook',1),(9,'linkedin','LinkedIn Post',1920,1080,600,209715200,30,'3M','16:9','Publication LinkedIn',1),(10,'twitter','Twitter Video',1920,1080,140,52428800,30,'2M','16:9','Vidéo Twitter/X',1);

--
-- Table structure for table `social_platforms`
--

CREATE TABLE `social_platforms` (
  `id` int NOT NULL AUTO_INCREMENT,
  `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `display_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `icon` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `color` varchar(7) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `api_endpoint` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `documentation_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `character_limit` int DEFAULT NULL,
  `supports_images` tinyint(1) DEFAULT '1',
  `supports_videos` tinyint(1) DEFAULT '1',
  `supports_scheduling` tinyint(1) DEFAULT '1',
  `requires_approval` tinyint(1) DEFAULT '0',
  `is_active` tinyint(1) DEFAULT '1',
  `settings` json DEFAULT NULL,
  `created_at` datetime DEFAULT CURRENT_TIMESTAMP,
  `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `name` (`name`),
  KEY `idx_platforms_name` (`name`),
  KEY `idx_platforms_active` (`is_active`)
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `social_platforms`
--

INSERT INTO `social_platforms` VALUES (7,'instagram','Instagram','📸','#E4405F',NULL,NULL,2200,1,1,1,0,1,NULL,'2025-07-25 05:59:34','2025-07-25 05:59:34'),(8,'facebook','Facebook','📘','#1877F2',NULL,NULL,63206,1,1,1,0,1,NULL,'2025-07-25 05:59:34','2025-07-25 05:59:34'),(9,'twitter','Twitter','🐦','#1DA1F2',NULL,NULL,280,1,1,1,0,1,NULL,'2025-07-25 05:59:34','2025-07-25 05:59:34'),(10,'linkedin','LinkedIn','💼','#0077B5',NULL,NULL,3000,1,1,1,0,1,NULL,'2025-07-25 05:59:34','2025-07-25 05:59:34'),(11,'tiktok','TikTok','🎵','#FF0050',NULL,NULL,300,1,1,1,0,1,NULL,'2025-07-25 05:59:34','2025-07-25 05:59:34'),(12,'youtube','YouTube','📺','#FF0000',NULL,NULL,5000,1,1,1,0,1,NULL,'2025-07-25 05:59:34','2025-07-25 05:59:34');

--
-- Table structure for table `template_favorites`
--

CREATE TABLE `template_favorites` (
  `id` int NOT NULL AUTO_INCREMENT,
  `template_id` int NOT NULL,
  `user_id` int NOT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `unique_user_favorite` (`template_id`,`user_id`),
  KEY `user_id` (`user_id`),
  CONSTRAINT `template_favorites_ibfk_1` FOREIGN KEY (`template_id`) REFERENCES `flying_book_templates` (`id`) ON DELETE CASCADE,
  CONSTRAINT `template_favorites_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `template_favorites`
--


--
-- Table structure for table `template_ratings`
--

CREATE TABLE `template_ratings` (
  `id` int NOT NULL AUTO_INCREMENT,
  `template_id` int NOT NULL,
  `user_id` int NOT NULL,
  `rating` int NOT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `unique_user_rating` (`template_id`,`user_id`),
  KEY `user_id` (`user_id`),
  CONSTRAINT `template_ratings_ibfk_1` FOREIGN KEY (`template_id`) REFERENCES `flying_book_templates` (`id`) ON DELETE CASCADE,
  CONSTRAINT `template_ratings_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  CONSTRAINT `template_ratings_chk_1` CHECK (((`rating` >= 1) and (`rating` <= 5)))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `template_ratings`
--


--
-- Table structure for table `templates`
--

CREATE TABLE `templates` (
  `id` int NOT NULL AUTO_INCREMENT,
  `project_id` int DEFAULT NULL,
  `user_id` int NOT NULL,
  `nom` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `contenu` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `platform` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `post_type` enum('text','image','video','carousel','story','reel','poll') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT 'text',
  `tags` json DEFAULT NULL,
  `variables` json DEFAULT NULL,
  `settings` json DEFAULT NULL,
  `is_public` tinyint(1) DEFAULT '0',
  `usage_count` int DEFAULT '0',
  `created_at` datetime DEFAULT CURRENT_TIMESTAMP,
  `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_templates_project_id` (`project_id`),
  KEY `idx_templates_user_id` (`user_id`),
  KEY `idx_templates_platform` (`platform`),
  KEY `idx_templates_is_public` (`is_public`),
  CONSTRAINT `templates_ibfk_1` FOREIGN KEY (`project_id`) REFERENCES `projects` (`id`) ON DELETE CASCADE,
  CONSTRAINT `templates_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `templates`
--


--
-- Table structure for table `token_package_transactions`
--

CREATE TABLE `token_package_transactions` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int NOT NULL,
  `package_id` int NOT NULL,
  `transaction_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'ID transaction Stripe/PayPal',
  `amount` decimal(10,2) NOT NULL,
  `currency` varchar(3) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT 'EUR',
  `payment_method` enum('stripe','paypal','bank_transfer','crypto') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT 'stripe',
  `payment_status` enum('pending','completed','failed','refunded') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT 'pending',
  `payment_data` json DEFAULT NULL COMMENT 'Données brutes du processeur de paiement',
  `ip_address` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `user_agent` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `transaction_id` (`transaction_id`),
  KEY `idx_user_transactions` (`user_id`,`payment_status`),
  KEY `idx_package_transactions` (`package_id`),
  CONSTRAINT `fk_transactions_package` FOREIGN KEY (`package_id`) REFERENCES `user_token_packages` (`id`) ON DELETE CASCADE,
  CONSTRAINT `fk_transactions_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Historique transactions paiements packages';

--
-- Dumping data for table `token_package_transactions`
--


--
-- Table structure for table `token_packages_catalog`
--

CREATE TABLE `token_packages_catalog` (
  `id` int NOT NULL AUTO_INCREMENT,
  `package_key` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `package_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `tokens_included` int NOT NULL,
  `price_eur` decimal(10,2) NOT NULL,
  `description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `features` json DEFAULT NULL,
  `color_hex` varchar(7) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '#007bff',
  `is_popular` tinyint(1) DEFAULT '0',
  `is_active` tinyint(1) DEFAULT '1',
  `sort_order` int DEFAULT '0',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `package_key` (`package_key`),
  KEY `idx_active_packages` (`is_active`,`sort_order`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `token_packages_catalog`
--

INSERT INTO `token_packages_catalog` VALUES (1,'starter','🌱 Starter',10000,5.00,'Parfait pour débuter','[\"~300 posts Instagram\", \"~15 articles blog\", \"~400 réponses clients\", \"Support email\"]','#28a745',0,1,1,'2025-07-26 13:57:22','2025-07-26 13:59:02'),(2,'business','💼 Business',50000,20.00,'Le plus populaire','[\"~1500 posts Instagram\", \"~75 articles blog\", \"Support prioritaire\"]','#007bff',1,1,2,'2025-07-26 13:57:22','2025-07-26 13:57:22'),(3,'pro','🚀 Pro',100000,35.00,'Pour les gros volumes','[\"~3000 posts Instagram\", \"~150 articles blog\", \"API access\"]','#6f42c1',0,1,3,'2025-07-26 13:57:22','2025-07-26 13:57:22'),(4,'enterprise','🏢 Enterprise',250000,80.00,'Volume professionnel','[\"~7500 posts Instagram\", \"Account manager dédié\"]','#fd7e14',0,1,4,'2025-07-26 13:57:22','2025-07-26 13:57:22');

--
-- Table structure for table `transitions`
--

CREATE TABLE `transitions` (
  `id` int NOT NULL AUTO_INCREMENT,
  `nom` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `code_ffmpeg` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `duree_defaut` float DEFAULT '1',
  `description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `actif` tinyint unsigned DEFAULT '1',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=35 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `transitions`
--

INSERT INTO `transitions` VALUES (20,'Fondu Enchaîné','fade',1,'Transition classique en fondu',1,'2025-07-14 13:05:48'),(21,'Glissement Gauche','slideright',0.8,'Glissement de droite à gauche',1,'2025-07-14 13:05:48'),(22,'Glissement Droite','slideleft',0.8,'Glissement de gauche à droite',1,'2025-07-14 13:05:48'),(23,'Glissement Haut','slidedown',0.8,'Glissement de bas en haut',1,'2025-07-14 13:05:48'),(24,'Glissement Bas','slideup',0.8,'Glissement de haut en bas',1,'2025-07-14 13:05:48'),(25,'Zoom In','zoomin',1.2,'Zoom avant sur nouveau clip',1,'2025-07-14 13:05:48'),(26,'Zoom Out','zoomout',1.2,'Zoom arrière vers nouveau clip',1,'2025-07-14 13:05:48'),(27,'Rotation','rotate',1.5,'Rotation 3D entre clips',1,'2025-07-14 13:05:48'),(28,'Pixellisation','pixelize',0.6,'Effet de pixellisation',1,'2025-07-14 13:05:48'),(29,'Flou Gaussien','blur',1,'Transition avec flou',1,'2025-07-14 13:05:48'),(30,'Cercle Fermeture','circleclose',1.2,'Fermeture en cercle',1,'2025-07-14 13:05:48'),(31,'Cercle Ouverture','circleopen',1.2,'Ouverture en cercle',1,'2025-07-14 13:05:48'),(32,'Volets Verticaux','vslitgate',1,'Volets qui s\'ouvrent verticalement',1,'2025-07-14 13:05:48'),(33,'Volets Horizontaux','hslitgate',1,'Volets qui s\'ouvrent horizontalement',1,'2025-07-14 13:05:48'),(34,'Balayage Diagonal','diagtl',0.8,'Balayage diagonal',1,'2025-07-14 13:05:48');

--
-- Table structure for table `transmission_logs`
--

CREATE TABLE `transmission_logs` (
  `id` int NOT NULL AUTO_INCREMENT,
  `scheduled_post_id` int NOT NULL,
  `network` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `status` enum('success','failed','retry','cancelled') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `attempt_number` int DEFAULT '1',
  `response_data` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `error_message` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `execution_time_ms` int DEFAULT '0',
  `external_post_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `transmitted_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_transmission_logs_scheduled` (`scheduled_post_id`),
  KEY `idx_transmission_logs_network` (`network`),
  KEY `idx_transmission_logs_status` (`status`),
  KEY `idx_transmission_logs_date` (`transmitted_at`),
  CONSTRAINT `fk_transmission_logs_scheduled` FOREIGN KEY (`scheduled_post_id`) REFERENCES `scheduled_posts` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `transmission_logs`
--


--
-- Table structure for table `user_ai_quotas`
--

CREATE TABLE `user_ai_quotas` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int NOT NULL,
  `quota_period` enum('daily','weekly','monthly','yearly') COLLATE utf8mb4_unicode_ci DEFAULT 'monthly',
  `quota_start_date` date NOT NULL,
  `quota_end_date` date NOT NULL,
  `tokens_limit` int NOT NULL DEFAULT '10000' COMMENT 'Limite tokens période',
  `tokens_used` int DEFAULT '0' COMMENT 'Tokens consommés',
  `tokens_remaining` int GENERATED ALWAYS AS ((`tokens_limit` - `tokens_used`)) STORED,
  `cost_limit` decimal(10,2) DEFAULT '10.00' COMMENT 'Limite coût euros',
  `cost_used` decimal(10,2) DEFAULT '0.00' COMMENT 'Coût consommé',
  `requests_limit` int DEFAULT '100' COMMENT 'Limite requêtes',
  `requests_used` int DEFAULT '0' COMMENT 'Requêtes utilisées',
  `ai_provider` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Si quota spécifique provider',
  `auto_renew` tinyint(1) DEFAULT '1' COMMENT 'Renouvellement auto',
  `alert_at_percentage` int DEFAULT '80' COMMENT 'Alerte à 80% quota',
  `alert_sent` tinyint(1) DEFAULT '0' COMMENT 'Alerte déjà envoyée',
  `is_active` tinyint(1) DEFAULT '1',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `user_period_provider` (`user_id`,`quota_period`,`ai_provider`,`quota_start_date`),
  KEY `idx_user_active` (`user_id`,`is_active`),
  KEY `idx_period_dates` (`quota_period`,`quota_start_date`,`quota_end_date`),
  KEY `idx_alerts` (`alert_at_percentage`,`alert_sent`),
  CONSTRAINT `fk_ai_quotas_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Quotas et facturation IA par utilisateur';

--
-- Dumping data for table `user_ai_quotas`
--

INSERT INTO `user_ai_quotas` (`id`, `user_id`, `quota_period`, `quota_start_date`, `quota_end_date`, `tokens_limit`, `tokens_used`, `cost_limit`, `cost_used`, `requests_limit`, `requests_used`, `ai_provider`, `auto_renew`, `alert_at_percentage`, `alert_sent`, `is_active`, `created_at`, `updated_at`) VALUES (1,4,'monthly','2025-07-01','2025-07-31',10000,0,10.00,0.00,100,0,'',1,80,0,1,'2025-07-25 13:16:50','2025-07-25 13:16:50'),(2,1,'monthly','2025-01-01','2025-01-31',10000,0,10.00,0.00,100,0,NULL,1,80,0,0,'2025-07-25 13:48:38','2025-07-26 12:11:32'),(3,5,'monthly','2025-07-01','2025-07-31',10000,0,10.00,0.00,100,0,NULL,1,80,0,1,'2025-07-26 12:11:32','2025-07-26 12:11:32'),(4,6,'monthly','2025-07-01','2025-07-31',10000,0,10.00,0.00,100,0,NULL,1,80,0,1,'2025-07-26 12:11:32','2025-07-26 12:11:32'),(5,1,'monthly','2025-07-01','2025-07-31',10000,0,10.00,0.00,100,0,NULL,1,80,0,1,'2025-07-26 12:11:32','2025-07-26 12:11:32'),(6,4,'monthly','2025-07-01','2025-07-31',10000,0,10.00,0.00,100,0,NULL,1,80,0,1,'2025-07-27 14:43:35','2025-07-27 14:43:35');

--
-- Table structure for table `user_downloads`
--

CREATE TABLE `user_downloads` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int NOT NULL,
  `post_id` int DEFAULT NULL,
  `download_type` enum('post','media','final','zip') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT 'zip',
  `file_path` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `file_size` bigint DEFAULT '0',
  `download_count` int DEFAULT '0',
  `expires_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `last_downloaded` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_user_downloads_user` (`user_id`),
  KEY `idx_user_downloads_post` (`post_id`),
  KEY `idx_user_downloads_expires` (`expires_at`),
  KEY `idx_downloads_cleanup` (`expires_at`,`created_at`),
  CONSTRAINT `fk_user_downloads_post` FOREIGN KEY (`post_id`) REFERENCES `posts` (`id`) ON DELETE SET NULL,
  CONSTRAINT `fk_user_downloads_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `user_downloads`
--


--
-- Table structure for table `user_limits`
--

CREATE TABLE `user_limits` (
  `user_id` int NOT NULL,
  `platform` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `max_accounts` int DEFAULT '1',
  PRIMARY KEY (`user_id`),
  CONSTRAINT `user_limits_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `user_limits`
--


--
-- Table structure for table `user_medias`
--

CREATE TABLE `user_medias` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int NOT NULL,
  `original_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `original_path` varchar(500) COLLATE utf8mb4_unicode_ci NOT NULL,
  `instagram_path` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `facebook_path` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `stories_path` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `twitter_path` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `file_size` int DEFAULT '0',
  `width` int DEFAULT '0',
  `height` int DEFAULT '0',
  `status` enum('active','trash') COLLATE utf8mb4_unicode_ci DEFAULT 'active',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_user_status` (`user_id`,`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `user_medias`
--


--
-- Table structure for table `user_sessions`
--

CREATE TABLE `user_sessions` (
  `id` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL,
  `user_id` int NOT NULL,
  `ip_address` varchar(45) COLLATE utf8mb4_unicode_ci NOT NULL,
  `user_agent` text COLLATE utf8mb4_unicode_ci,
  `last_activity` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `expires_at` timestamp NOT NULL,
  PRIMARY KEY (`id`),
  KEY `user_id` (`user_id`),
  CONSTRAINT `user_sessions_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `user_sessions`
--


--
-- Temporary view structure for view `user_token_balance`
--

/*!50001 DROP VIEW IF EXISTS `user_token_balance`*/;
/*!50001 CREATE VIEW `user_token_balance` AS SELECT 
 1 AS `user_id`,
 1 AS `user_name`,
 1 AS `total_purchased`,
 1 AS `total_used`,
 1 AS `current_balance`,
 1 AS `total_spent`,
 1 AS `packages_count`,
 1 AS `latest_expiry`*/;

--
-- Table structure for table `user_token_packages`
--

CREATE TABLE `user_token_packages` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int NOT NULL,
  `package_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'starter, business, pro, enterprise',
  `tokens_purchased` int NOT NULL COMMENT 'Tokens achetés dans ce package',
  `tokens_used` int DEFAULT '0' COMMENT 'Tokens déjà consommés de ce package',
  `tokens_remaining` int GENERATED ALWAYS AS ((`tokens_purchased` - `tokens_used`)) STORED,
  `price_paid` decimal(10,2) NOT NULL COMMENT 'Prix payé en euros',
  `payment_reference` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Référence paiement (Stripe, PayPal, etc.)',
  `purchase_date` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `expires_at` timestamp NULL DEFAULT NULL COMMENT 'Date expiration tokens (1 an)',
  `status` enum('pending','active','expired','refunded') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT 'pending',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_user_packages` (`user_id`,`status`),
  KEY `idx_package_name` (`package_name`),
  KEY `idx_expires` (`expires_at`),
  CONSTRAINT `fk_token_packages_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Packages tokens achetés par utilisateur';

--
-- Dumping data for table `user_token_packages`
--

INSERT INTO `user_token_packages` (`id`, `user_id`, `package_name`, `tokens_purchased`, `tokens_used`, `price_paid`, `payment_reference`, `purchase_date`, `expires_at`, `status`, `created_at`, `updated_at`) VALUES (1,7,'business',50000,100,20.00,NULL,'2025-07-26 14:01:54',NULL,'active','2025-07-26 14:01:54','2025-07-26 16:53:51');

--
-- Table structure for table `user_workflow_permissions`
--

CREATE TABLE `user_workflow_permissions` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int NOT NULL,
  `stage_name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `can_view` tinyint(1) DEFAULT '1',
  `can_process` tinyint(1) DEFAULT '0',
  `can_approve` tinyint(1) DEFAULT '0',
  `can_delete` tinyint(1) DEFAULT '0',
  `is_manager` tinyint(1) DEFAULT '0',
  PRIMARY KEY (`id`),
  UNIQUE KEY `user_stage_unique` (`user_id`,`stage_name`),
  KEY `idx_user_permissions` (`user_id`),
  KEY `user_workflow_permissions_stage_fk` (`stage_name`),
  CONSTRAINT `user_workflow_permissions_stage_fk` FOREIGN KEY (`stage_name`) REFERENCES `workflow_stages` (`stage_name`) ON DELETE CASCADE,
  CONSTRAINT `user_workflow_permissions_user_fk` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `user_workflow_permissions`
--

INSERT INTO `user_workflow_permissions` VALUES (1,1,'clipmaker',1,1,1,1,1),(2,1,'audio_postprod',1,1,1,1,1),(3,1,'emission_final',1,1,1,1,1),(4,1,'social_ready',1,1,1,1,1),(5,4,'clipmaker',1,1,1,1,1),(6,4,'audio_postprod',1,1,1,1,1),(7,4,'emission_final',1,1,1,1,1),(8,4,'social_ready',1,1,1,1,1),(9,5,'clipmaker',1,1,0,0,0),(10,5,'audio_postprod',1,0,0,0,0),(11,5,'emission_final',1,0,0,0,0),(12,5,'social_ready',1,1,0,0,0);

--
-- Temporary view structure for view `v_dashboard_active_exports`
--

/*!50001 DROP VIEW IF EXISTS `v_dashboard_active_exports`*/;
/*!50001 CREATE VIEW `v_dashboard_active_exports` AS SELECT 
 1 AS `id`,
 1 AS `export_name`,
 1 AS `stage`,
 1 AS `stage_name`,
 1 AS `status`,
 1 AS `progress`,
 1 AS `project_name`,
 1 AS `user_name`,
 1 AS `created_at`,
 1 AS `processing_started_at`,
 1 AS `processing_minutes`,
 1 AS `estimated_progress`*/;

--
-- Temporary view structure for view `v_dashboard_project_summary`
--

/*!50001 DROP VIEW IF EXISTS `v_dashboard_project_summary`*/;
/*!50001 CREATE VIEW `v_dashboard_project_summary` AS SELECT 
 1 AS `project_id`,
 1 AS `project_name`,
 1 AS `user_id`,
 1 AS `user_name`,
 1 AS `project_status`,
 1 AS `project_created`,
 1 AS `project_updated`,
 1 AS `media_count`,
 1 AS `total_exports`,
 1 AS `clipmaker_exports`,
 1 AS `audio_exports`,
 1 AS `final_exports`,
 1 AS `social_exports`,
 1 AS `workflow_status`,
 1 AS `last_workflow_activity`*/;

--
-- Temporary view structure for view `v_user_ai_stats`
--

/*!50001 DROP VIEW IF EXISTS `v_user_ai_stats`*/;
/*!50001 CREATE VIEW `v_user_ai_stats` AS SELECT 
 1 AS `user_id`,
 1 AS `user_name`,
 1 AS `ai_profiles_count`,
 1 AS `total_requests`,
 1 AS `total_tokens_used`,
 1 AS `total_cost`,
 1 AS `avg_processing_time`,
 1 AS `failed_requests`,
 1 AS `last_ai_usage`*/;

--
-- Temporary view structure for view `v_user_current_quotas`
--

/*!50001 DROP VIEW IF EXISTS `v_user_current_quotas`*/;
/*!50001 CREATE VIEW `v_user_current_quotas` AS SELECT 
 1 AS `id`,
 1 AS `user_id`,
 1 AS `quota_period`,
 1 AS `quota_start_date`,
 1 AS `quota_end_date`,
 1 AS `tokens_limit`,
 1 AS `tokens_used`,
 1 AS `tokens_remaining`,
 1 AS `cost_limit`,
 1 AS `cost_used`,
 1 AS `requests_limit`,
 1 AS `requests_used`,
 1 AS `ai_provider`,
 1 AS `auto_renew`,
 1 AS `alert_at_percentage`,
 1 AS `alert_sent`,
 1 AS `is_active`,
 1 AS `created_at`,
 1 AS `updated_at`,
 1 AS `user_name`,
 1 AS `user_email`,
 1 AS `usage_percentage`,
 1 AS `quota_status`,
 1 AS `days_remaining`*/;

--
-- Temporary view structure for view `v_user_dashboard_stats`
--

/*!50001 DROP VIEW IF EXISTS `v_user_dashboard_stats`*/;
/*!50001 CREATE VIEW `v_user_dashboard_stats` AS SELECT 
 1 AS `user_id`,
 1 AS `user_name`,
 1 AS `email`,
 1 AS `role`,
 1 AS `total_projects`,
 1 AS `active_projects`,
 1 AS `total_exports`,
 1 AS `completed_exports`,
 1 AS `processing_exports`,
 1 AS `clipmaker_completed`,
 1 AS `social_ready_completed`,
 1 AS `total_media`,
 1 AS `total_storage_bytes`,
 1 AS `total_clients`,
 1 AS `total_posts`,
 1 AS `last_export_date`,
 1 AS `last_project_update`*/;

--
-- Table structure for table `workflow_exports`
--

CREATE TABLE `workflow_exports` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int NOT NULL,
  `project_id` int NOT NULL,
  `stage` enum('clipmaker','audio_postprod','emission_final','social_ready') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'clipmaker',
  `export_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `original_filename` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `file_path` varchar(1000) COLLATE utf8mb4_unicode_ci NOT NULL,
  `file_size` bigint DEFAULT '0',
  `format` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT 'mp4',
  `codec_video` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT 'h264',
  `codec_audio` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT 'aac',
  `resolution_width` int DEFAULT '1920',
  `resolution_height` int DEFAULT '1080',
  `fps` int DEFAULT '30',
  `bitrate_video` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT '5M',
  `bitrate_audio` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT '128k',
  `duration_seconds` float DEFAULT '0',
  `status` enum('processing','completed','failed','queued','approved','rejected') COLLATE utf8mb4_unicode_ci DEFAULT 'processing',
  `quality_preset` enum('draft','preview','broadcast','web','mobile') COLLATE utf8mb4_unicode_ci DEFAULT 'broadcast',
  `priority` enum('low','normal','high','urgent') COLLATE utf8mb4_unicode_ci DEFAULT 'normal',
  `version_number` int DEFAULT '1',
  `parent_export_id` int DEFAULT NULL,
  `is_final_version` tinyint(1) DEFAULT '0',
  `processed_by_user_id` int DEFAULT NULL,
  `approved_by_user_id` int DEFAULT NULL,
  `notes` text COLLATE utf8mb4_unicode_ci,
  `processing_log` text COLLATE utf8mb4_unicode_ci,
  `error_message` text COLLATE utf8mb4_unicode_ci,
  `progress` int DEFAULT '0',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `processing_started_at` timestamp NULL DEFAULT NULL,
  `completed_at` timestamp NULL DEFAULT NULL,
  `approved_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_workflow_user` (`user_id`),
  KEY `idx_workflow_project` (`project_id`),
  KEY `idx_workflow_stage` (`stage`),
  KEY `idx_workflow_status` (`status`),
  KEY `idx_workflow_created` (`created_at`),
  KEY `idx_workflow_parent` (`parent_export_id`),
  KEY `workflow_exports_processed_fk` (`processed_by_user_id`),
  KEY `workflow_exports_approved_fk` (`approved_by_user_id`),
  KEY `idx_workflow_user_stage` (`user_id`,`stage`),
  KEY `idx_workflow_project_stage` (`project_id`,`stage`),
  KEY `idx_workflow_status_stage` (`status`,`stage`),
  KEY `idx_workflow_completion` (`completed_at`,`stage`),
  CONSTRAINT `workflow_exports_approved_fk` FOREIGN KEY (`approved_by_user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  CONSTRAINT `workflow_exports_parent_fk` FOREIGN KEY (`parent_export_id`) REFERENCES `workflow_exports` (`id`) ON DELETE SET NULL,
  CONSTRAINT `workflow_exports_processed_fk` FOREIGN KEY (`processed_by_user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  CONSTRAINT `workflow_exports_project_fk` FOREIGN KEY (`project_id`) REFERENCES `clipmaker_projects` (`id`) ON DELETE CASCADE,
  CONSTRAINT `workflow_exports_user_fk` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `workflow_exports`
--


--
-- Table structure for table `workflow_stages`
--

CREATE TABLE `workflow_stages` (
  `id` int NOT NULL AUTO_INCREMENT,
  `stage_name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `stage_order` int NOT NULL,
  `display_name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `folder_path` varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL,
  `allowed_formats` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT 'mp4,mov,avi',
  `default_quality` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT 'broadcast',
  `auto_process` tinyint(1) DEFAULT '0',
  `requires_approval` tinyint(1) DEFAULT '0',
  `is_active` tinyint(1) DEFAULT '1',
  PRIMARY KEY (`id`),
  UNIQUE KEY `stage_name` (`stage_name`),
  KEY `idx_stage_order` (`stage_order`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `workflow_stages`
--

INSERT INTO `workflow_stages` VALUES (1,'clipmaker',1,'🎬 Montage Clipmaker','Export brut depuis Clipmaker','01_clipmaker_exports','mp4','broadcast',1,0,1),(2,'audio_postprod',2,'🎵 Post-Production Audio','Mix audio, effets sonores, mastering','02_audio_postprod','mp4,wav','broadcast',0,1,1),(3,'emission_final',3,'📺 Émission Finale','Habillage, générique, version finale','03_emission_final','mp4','broadcast',0,1,1),(4,'social_ready',4,'📱 Prêt Réseaux Sociaux','Formats adaptés par plateforme','04_social_ready','mp4,mov,webm','web',0,0,1);

--
-- Final view structure for view `clipmaker_recent_activity`
--

/*!50001 DROP VIEW IF EXISTS `clipmaker_recent_activity`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `clipmaker_recent_activity` AS select 'project' AS `type`,`cp`.`name` AS `title`,`cp`.`user_id` AS `user_id`,`cp`.`created_at` AS `activity_date`,'Projet créé' AS `description` from `clipmaker_projects` `cp` union all select 'export' AS `type`,concat('Export ',`ce`.`format`) AS `title`,`ce`.`user_id` AS `user_id`,`ce`.`created_at` AS `activity_date`,(case `ce`.`status` when 'completed' then 'Export terminé' when 'failed' then 'Export échoué' else 'Export en cours' end) AS `description` from `clipmaker_exports` `ce` union all select 'media' AS `type`,`cm`.`original_filename` AS `title`,`cm`.`user_id` AS `user_id`,`cm`.`created_at` AS `activity_date`,'Média uploadé' AS `description` from `clipmaker_media` `cm` order by `activity_date` desc limit 50 */;

--
-- Final view structure for view `clipmaker_user_stats`
--

/*!50001 DROP VIEW IF EXISTS `clipmaker_user_stats`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `clipmaker_user_stats` AS select `u`.`id` AS `user_id`,`u`.`name` AS `user_name`,count(distinct `cp`.`id`) AS `total_projects`,count(distinct `cm`.`id`) AS `total_media`,count(distinct `ce`.`id`) AS `total_exports`,sum((case when (`cp`.`status` = 'completed') then 1 else 0 end)) AS `completed_projects`,sum((case when (`ce`.`status` = 'completed') then 1 else 0 end)) AS `successful_exports`,coalesce(sum(`cm`.`file_size`),0) AS `total_storage_used`,max(`cp`.`created_at`) AS `last_project_date` from (((`users` `u` left join `clipmaker_projects` `cp` on((`u`.`id` = `cp`.`user_id`))) left join `clipmaker_media` `cm` on((`u`.`id` = `cm`.`user_id`))) left join `clipmaker_exports` `ce` on((`u`.`id` = `ce`.`user_id`))) group by `u`.`id`,`u`.`name` */;

--
-- Final view structure for view `user_token_balance`
--

/*!50001 DROP VIEW IF EXISTS `user_token_balance`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`laloedata`@`82.64.1.223` SQL SECURITY DEFINER */
/*!50001 VIEW `user_token_balance` AS select `u`.`id` AS `user_id`,`u`.`name` AS `user_name`,coalesce(sum(`utp`.`tokens_purchased`),0) AS `total_purchased`,coalesce(sum(`utp`.`tokens_used`),0) AS `total_used`,coalesce((sum(`utp`.`tokens_purchased`) - sum(`utp`.`tokens_used`)),0) AS `current_balance`,coalesce(sum(`utp`.`price_paid`),0) AS `total_spent`,count(`utp`.`id`) AS `packages_count`,max(`utp`.`expires_at`) AS `latest_expiry` from (`users` `u` left join `user_token_packages` `utp` on(((`u`.`id` = `utp`.`user_id`) and (`utp`.`status` = 'active')))) where (`u`.`status` = 'active') group by `u`.`id`,`u`.`name` */;

--
-- Final view structure for view `v_dashboard_active_exports`
--

/*!50001 DROP VIEW IF EXISTS `v_dashboard_active_exports`*/;

--
-- Final view structure for view `v_dashboard_project_summary`
--

/*!50001 DROP VIEW IF EXISTS `v_dashboard_project_summary`*/;

--
-- Final view structure for view `v_user_ai_stats`
--

/*!50001 DROP VIEW IF EXISTS `v_user_ai_stats`*/;

--
-- Final view structure for view `v_user_current_quotas`
--

/*!50001 DROP VIEW IF EXISTS `v_user_current_quotas`*/;

--
-- Final view structure for view `v_user_dashboard_stats`
--

/*!50001 DROP VIEW IF EXISTS `v_user_dashboard_stats`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`laloedata`@`82.64.1.223` SQL SECURITY DEFINER */
/*!50001 VIEW `v_user_dashboard_stats` AS select `u`.`id` AS `user_id`,`u`.`name` AS `user_name`,`u`.`email` AS `email`,`u`.`role` AS `role`,count(distinct `p`.`id`) AS `total_projects`,count(distinct (case when (`p`.`status` = 'active') then `p`.`id` end)) AS `active_projects`,count(distinct `we`.`id`) AS `total_exports`,count(distinct (case when (`we`.`status` = 'completed') then `we`.`id` end)) AS `completed_exports`,count(distinct (case when (`we`.`status` = 'processing') then `we`.`id` end)) AS `processing_exports`,count(distinct (case when ((`we`.`stage` = 'clipmaker') and (`we`.`status` = 'completed')) then `we`.`id` end)) AS `clipmaker_completed`,count(distinct (case when ((`we`.`stage` = 'social_ready') and (`we`.`status` = 'completed')) then `we`.`id` end)) AS `social_ready_completed`,count(distinct `cm`.`id`) AS `total_media`,coalesce(sum(`cm`.`file_size`),0) AS `total_storage_bytes`,count(distinct `c`.`id`) AS `total_clients`,count(distinct `po`.`id`) AS `total_posts`,max(`we`.`completed_at`) AS `last_export_date`,max(`p`.`updated_at`) AS `last_project_update` from (((((`users` `u` left join `clipmaker_projects` `p` on((`u`.`id` = `p`.`user_id`))) left join `workflow_exports` `we` on((`u`.`id` = `we`.`user_id`))) left join `clipmaker_media` `cm` on((`u`.`id` = `cm`.`user_id`))) left join `clients` `c` on((`u`.`id` = `c`.`created_by`))) left join `posts` `po` on((`u`.`id` = `po`.`user_id`))) where (`u`.`status` = 'active') group by `u`.`id`,`u`.`name`,`u`.`email`,`u`.`role` */;


