-- =====================================================================
-- TypeStudio Database Dump for Namecheap MySQL / MariaDB (cPanel)
-- Generated: 2026-10-26
-- Timezone: Africa/Nairobi (UTC+3)
-- Compatible with MySQL 5.7+, MySQL 8.0+, MariaDB 10.3+
-- Import via cPanel -> phpMyAdmin -> Import
-- =====================================================================

SET FOREIGN_KEY_CHECKS=0;
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET NAMES utf8mb4;

-- --------------------------------------------------------
-- Table structure for `migrations`
-- --------------------------------------------------------
DROP TABLE IF EXISTS `migrations`;
CREATE TABLE `migrations` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `batch` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
(1, '0001_01_01_000000_create_users_table', 1),
(2, '0001_01_01_000001_create_cache_table', 1),
(3, '0001_01_01_000002_create_jobs_table', 1),
(4, '2026_10_26_000001_create_studio_core_tables', 1);

-- --------------------------------------------------------
-- Table structure for `users`
-- --------------------------------------------------------
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `email_verified_at` timestamp NULL DEFAULT NULL,
  `password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `users_email_unique` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------
-- Table structure for `password_reset_tokens`
-- --------------------------------------------------------
DROP TABLE IF EXISTS `password_reset_tokens`;
CREATE TABLE `password_reset_tokens` (
  `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `token` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------
-- Table structure for `sessions`
-- --------------------------------------------------------
DROP TABLE IF EXISTS `sessions`;
CREATE TABLE `sessions` (
  `id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `user_id` bigint(20) unsigned DEFAULT NULL,
  `ip_address` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `user_agent` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `last_activity` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `sessions_user_id_index` (`user_id`),
  KEY `sessions_last_activity_index` (`last_activity`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------
-- Table structure for `cache`
-- --------------------------------------------------------
DROP TABLE IF EXISTS `cache`;
CREATE TABLE `cache` (
  `key` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `value` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `expiration` int(11) NOT NULL,
  PRIMARY KEY (`key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------
-- Table structure for `cache_locks`
-- --------------------------------------------------------
DROP TABLE IF EXISTS `cache_locks`;
CREATE TABLE `cache_locks` (
  `key` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `owner` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `expiration` int(11) NOT NULL,
  PRIMARY KEY (`key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------
-- Table structure for `jobs`
-- --------------------------------------------------------
DROP TABLE IF EXISTS `jobs`;
CREATE TABLE `jobs` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `queue` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `attempts` tinyint(3) unsigned NOT NULL,
  `reserved_at` int(10) unsigned DEFAULT NULL,
  `available_at` int(10) unsigned NOT NULL,
  `created_at` int(10) unsigned NOT NULL,
  PRIMARY KEY (`id`),
  KEY `jobs_queue_index` (`queue`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------
-- Table structure for `job_batches`
-- --------------------------------------------------------
DROP TABLE IF EXISTS `job_batches`;
CREATE TABLE `job_batches` (
  `id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `total_jobs` int(11) NOT NULL,
  `pending_jobs` int(11) NOT NULL,
  `failed_jobs` int(11) NOT NULL,
  `failed_job_ids` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `options` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `cancelled_at` int(11) DEFAULT NULL,
  `created_at` int(11) NOT NULL,
  `finished_at` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------
-- Table structure for `failed_jobs`
-- --------------------------------------------------------
DROP TABLE IF EXISTS `failed_jobs`;
CREATE TABLE `failed_jobs` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `uuid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `connection` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `queue` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `exception` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `failed_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------
-- Table structure for `projects`
-- --------------------------------------------------------
DROP TABLE IF EXISTS `projects`;
CREATE TABLE `projects` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint(20) unsigned NOT NULL,
  `title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `aspect_ratio` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '9:16',
  `resolution` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '1080p',
  `font_settings` json DEFAULT NULL,
  `animation_settings` json DEFAULT NULL,
  `audio_settings` json DEFAULT NULL,
  `background_settings` json DEFAULT NULL,
  `text_content` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `duration_seconds` decimal(8,2) NOT NULL DEFAULT '0.00',
  `status` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'draft',
  `thumbnail_path` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `latest_rendered_asset_id` bigint(20) unsigned DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `projects_user_id_status_index` (`user_id`,`status`),
  KEY `projects_user_id_updated_at_index` (`user_id`,`updated_at`),
  CONSTRAINT `projects_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------
-- Table structure for `project_versions`
-- --------------------------------------------------------
DROP TABLE IF EXISTS `project_versions`;
CREATE TABLE `project_versions` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `project_id` bigint(20) unsigned NOT NULL,
  `version_number` int(11) NOT NULL,
  `snapshot_data` json NOT NULL,
  `change_summary` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `project_versions_project_id_version_number_index` (`project_id`,`version_number`),
  CONSTRAINT `project_versions_project_id_foreign` FOREIGN KEY (`project_id`) REFERENCES `projects` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------
-- Table structure for `templates`
-- --------------------------------------------------------
DROP TABLE IF EXISTS `templates`;
CREATE TABLE `templates` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint(20) unsigned DEFAULT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `category` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'general',
  `description` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `config` json NOT NULL,
  `is_default` tinyint(1) NOT NULL DEFAULT '0',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  CONSTRAINT `templates_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------
-- Table structure for `media_assets`
-- --------------------------------------------------------
DROP TABLE IF EXISTS `media_assets`;
CREATE TABLE `media_assets` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint(20) unsigned NOT NULL,
  `project_id` bigint(20) unsigned DEFAULT NULL,
  `title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `original_filename` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `disk_path` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `storage_disk` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'local',
  `mime_type` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `file_size_bytes` bigint(20) unsigned NOT NULL,
  `duration_seconds` decimal(8,2) DEFAULT NULL,
  `width` int(11) DEFAULT NULL,
  `height` int(11) DEFAULT NULL,
  `asset_type` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL,
  `is_protected` tinyint(1) NOT NULL DEFAULT '1',
  `metadata` json DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `media_assets_user_id_asset_type_index` (`user_id`,`asset_type`),
  CONSTRAINT `media_assets_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------
-- Table structure for `social_accounts`
-- --------------------------------------------------------
DROP TABLE IF EXISTS `social_accounts`;
CREATE TABLE `social_accounts` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint(20) unsigned NOT NULL,
  `platform` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL,
  `account_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `account_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `username` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `avatar_url` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `access_token` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `refresh_token` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `token_expires_at` timestamp NULL DEFAULT NULL,
  `scopes` json DEFAULT NULL,
  `account_metadata` json DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `social_accounts_user_id_platform_account_id_unique` (`user_id`,`platform`,`account_id`),
  CONSTRAINT `social_accounts_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------
-- Table structure for `oauth_states`
-- --------------------------------------------------------
DROP TABLE IF EXISTS `oauth_states`;
CREATE TABLE `oauth_states` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `state_token` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
  `platform` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL,
  `user_id` bigint(20) unsigned NOT NULL,
  `redirect_uri` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `metadata` json DEFAULT NULL,
  `expires_at` timestamp NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `oauth_states_state_token_unique` (`state_token`),
  CONSTRAINT `oauth_states_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------
-- Table structure for `scheduled_posts`
-- --------------------------------------------------------
DROP TABLE IF EXISTS `scheduled_posts`;
CREATE TABLE `scheduled_posts` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint(20) unsigned NOT NULL,
  `media_asset_id` bigint(20) unsigned DEFAULT NULL,
  `project_id` bigint(20) unsigned DEFAULT NULL,
  `title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `default_caption` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `scheduled_at` timestamp NOT NULL,
  `timezone` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'Africa/Nairobi',
  `status` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'draft',
  `error_message` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `claimed_at` timestamp NULL DEFAULT NULL,
  `claimed_by_worker` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `retry_count` int(11) NOT NULL DEFAULT '0',
  `max_retries` int(11) NOT NULL DEFAULT '3',
  `published_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `scheduled_posts_status_scheduled_at_index` (`status`,`scheduled_at`),
  KEY `scheduled_posts_user_id_status_index` (`user_id`,`status`),
  CONSTRAINT `scheduled_posts_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------
-- Table structure for `post_platform_settings`
-- --------------------------------------------------------
DROP TABLE IF EXISTS `post_platform_settings`;
CREATE TABLE `post_platform_settings` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `scheduled_post_id` bigint(20) unsigned NOT NULL,
  `social_account_id` bigint(20) unsigned NOT NULL,
  `platform` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL,
  `custom_caption` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `custom_title` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `custom_description` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `hashtags` json DEFAULT NULL,
  `platform_options` json DEFAULT NULL,
  `status` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'pending',
  `platform_post_id` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `platform_publish_id` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `published_url` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `error_details` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `attempts_count` int(11) NOT NULL DEFAULT '0',
  `published_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `post_platform_settings_scheduled_post_id_platform_index` (`scheduled_post_id`,`platform`),
  KEY `post_platform_settings_status_index` (`status`),
  CONSTRAINT `post_platform_settings_scheduled_post_id_foreign` FOREIGN KEY (`scheduled_post_id`) REFERENCES `scheduled_posts` (`id`) ON DELETE CASCADE,
  CONSTRAINT `post_platform_settings_social_account_id_foreign` FOREIGN KEY (`social_account_id`) REFERENCES `social_accounts` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------
-- Table structure for `publishing_attempts`
-- --------------------------------------------------------
DROP TABLE IF EXISTS `publishing_attempts`;
CREATE TABLE `publishing_attempts` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `scheduled_post_id` bigint(20) unsigned NOT NULL,
  `post_platform_setting_id` bigint(20) unsigned DEFAULT NULL,
  `platform` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL,
  `request_summary` json DEFAULT NULL,
  `response_summary` json DEFAULT NULL,
  `is_success` tinyint(1) NOT NULL DEFAULT '0',
  `error_code` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `error_message` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `attempted_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `publishing_attempts_scheduled_post_id_attempted_at_index` (`scheduled_post_id`,`attempted_at`),
  CONSTRAINT `publishing_attempts_scheduled_post_id_foreign` FOREIGN KEY (`scheduled_post_id`) REFERENCES `scheduled_posts` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------
-- Table structure for `application_settings`
-- --------------------------------------------------------
DROP TABLE IF EXISTS `application_settings`;
CREATE TABLE `application_settings` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `key` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `value` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `type` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'string',
  `group` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'general',
  `description` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `application_settings_key_unique` (`key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------
-- Table structure for `activity_logs`
-- --------------------------------------------------------
DROP TABLE IF EXISTS `activity_logs`;
CREATE TABLE `activity_logs` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint(20) unsigned DEFAULT NULL,
  `action` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `entity_type` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `entity_id` bigint(20) unsigned DEFAULT NULL,
  `metadata` json DEFAULT NULL,
  `ip_address` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `activity_logs_user_id_created_at_index` (`user_id`,`created_at`),
  CONSTRAINT `activity_logs_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------
-- Dumping data for table `users`
-- --------------------------------------------------------
INSERT INTO `users` (`id`, `name`, `email`, `password`, `created_at`, `updated_at`) VALUES (1, 'Studio Admin', 'admin@typestudio.local', '$2y$12$HIjaLxbhCeurXJgpmXEa6exlJwHyBKvs/dxSHX2fM6nozeQwQj602', NOW(), NOW());

-- --------------------------------------------------------
-- Dumping data for table `application_settings`
-- --------------------------------------------------------
INSERT INTO `application_settings` (`key`, `value`, `type`, `group`, `description`, `created_at`, `updated_at`) VALUES ('app_timezone', 'Africa/Nairobi', 'string', 'general', 'Default application timezone', NOW(), NOW());
INSERT INTO `application_settings` (`key`, `value`, `type`, `group`, `description`, `created_at`, `updated_at`) VALUES ('default_aspect_ratio', '9:16', 'string', 'video', 'Default video ratio (9:16 vertical, 1:1 square, 16:9 landscape)', NOW(), NOW());
INSERT INTO `application_settings` (`key`, `value`, `type`, `group`, `description`, `created_at`, `updated_at`) VALUES ('default_resolution', '1080p', 'string', 'video', 'Default video export resolution', NOW(), NOW());
INSERT INTO `application_settings` (`key`, `value`, `type`, `group`, `description`, `created_at`, `updated_at`) VALUES ('default_sound_profile', 'mechanical', 'string', 'audio', 'Default typing sound (mechanical, typewriter, soft)', NOW(), NOW());
INSERT INTO `application_settings` (`key`, `value`, `type`, `group`, `description`, `created_at`, `updated_at`) VALUES ('default_sound_volume', '0.75', 'float', 'audio', 'Default typing audio volume (0.0 - 1.0)', NOW(), NOW());
INSERT INTO `application_settings` (`key`, `value`, `type`, `group`, `description`, `created_at`, `updated_at`) VALUES ('default_typing_speed', '45', 'integer', 'animation', 'Default typing speed in milliseconds per character', NOW(), NOW());
INSERT INTO `application_settings` (`key`, `value`, `type`, `group`, `description`, `created_at`, `updated_at`) VALUES ('media_retention_days', '90', 'integer', 'storage', 'Days to retain completed videos after publishing', NOW(), NOW());
INSERT INTO `application_settings` (`key`, `value`, `type`, `group`, `description`, `created_at`, `updated_at`) VALUES ('max_video_size_mb', '250', 'integer', 'storage', 'Maximum upload file size in megabytes', NOW(), NOW());
INSERT INTO `application_settings` (`key`, `value`, `type`, `group`, `description`, `created_at`, `updated_at`) VALUES ('email_notifications_enabled', '0', 'boolean', 'notifications', 'Send email alerts upon post failure', NOW(), NOW());
INSERT INTO `application_settings` (`key`, `value`, `type`, `group`, `description`, `created_at`, `updated_at`) VALUES ('notification_email', 'admin@typestudio.local', 'string', 'notifications', 'Recipient email for scheduled publishing alerts', NOW(), NOW());

-- --------------------------------------------------------
-- Dumping data for table `templates`
-- --------------------------------------------------------
INSERT INTO `templates` (`user_id`, `name`, `category`, `description`, `config`, `is_default`, `created_at`, `updated_at`) VALUES (1, 'Quote Spotlight (Vertical 9:16)', 'quote', 'Elegant centered quotes with smooth word-by-word reveal and mechanical key clicks.', '{\"aspect_ratio\":\"9:16\",\"resolution\":\"1080p\",\"font_settings\":{\"fontFamily\":\"Merriweather, serif\",\"fontSize\":48,\"fontWeight\":\"600\",\"textColor\":\"#FFFFFF\",\"textAlign\":\"center\",\"lineHeight\":1.5,\"letterSpacing\":1,\"shadow\":\"0 4px 12px rgba(0,0,0,0.8)\",\"padding\":40,\"maxWidthPercent\":88,\"positionY\":\"center\"},\"animation_settings\":{\"mode\":\"word\",\"speedMs\":110,\"wordPauseMs\":120,\"sentencePauseMs\":450,\"paragraphPauseMs\":600,\"startDelayMs\":800,\"endDelayMs\":2500,\"cursorStyle\":\"line\",\"cursorColor\":\"#FBBF24\",\"cursorBlink\":true,\"textEntrance\":\"fade_in\"},\"audio_settings\":{\"profile\":\"mechanical\",\"volume\":0.75,\"enabled\":true,\"pitchVariation\":true,\"punctuationSound\":true,\"fadeInMs\":200,\"fadeOutMs\":600},\"background_settings\":{\"type\":\"gradient\",\"gradientDirection\":\"to bottom right\",\"gradientStart\":\"#0F172A\",\"gradientEnd\":\"#020617\",\"blur\":0,\"brightness\":1,\"contrast\":1,\"overlayOpacity\":0.4,\"overlayColor\":\"#000000\"},\"text_content\":\"\\u201cThe future belongs to those who believe in the beauty of their dreams.\\u201d\\n\\n\\u2014 Eleanor Roosevelt\"}', 1, NOW(), NOW());
INSERT INTO `templates` (`user_id`, `name`, `category`, `description`, `config`, `is_default`, `created_at`, `updated_at`) VALUES (1, 'Motivational Pulse (Vertical 9:16)', 'motivational', 'Fast typewriter animation with gold cursor accents, perfect for TikTok & Reels.', '{\"aspect_ratio\":\"9:16\",\"resolution\":\"1080p\",\"font_settings\":{\"fontFamily\":\"Inter, sans-serif\",\"fontSize\":52,\"fontWeight\":\"800\",\"textColor\":\"#F3F4F6\",\"textAlign\":\"center\",\"lineHeight\":1.4,\"letterSpacing\":0.5,\"shadow\":\"0 8px 24px rgba(0,0,0,0.9)\",\"padding\":40,\"maxWidthPercent\":85,\"positionY\":\"center\"},\"animation_settings\":{\"mode\":\"char\",\"speedMs\":38,\"wordPauseMs\":60,\"sentencePauseMs\":350,\"paragraphPauseMs\":500,\"startDelayMs\":600,\"endDelayMs\":2000,\"cursorStyle\":\"block\",\"cursorColor\":\"#F59E0B\",\"cursorBlink\":true,\"textEntrance\":\"typewriter\"},\"audio_settings\":{\"profile\":\"typewriter\",\"volume\":0.85,\"enabled\":true,\"pitchVariation\":true,\"punctuationSound\":true,\"fadeInMs\":100,\"fadeOutMs\":400},\"background_settings\":{\"type\":\"gradient\",\"gradientDirection\":\"to bottom\",\"gradientStart\":\"#18181B\",\"gradientEnd\":\"#09090B\",\"blur\":0,\"brightness\":1,\"contrast\":1.1,\"overlayOpacity\":0.5,\"overlayColor\":\"#000000\"},\"text_content\":\"Small daily disciplines repeated consistently lead to staggering achievements over time.\\n\\nKeep showing up.\"}', 1, NOW(), NOW());
INSERT INTO `templates` (`user_id`, `name`, `category`, `description`, `config`, `is_default`, `created_at`, `updated_at`) VALUES (1, 'Educational Explainer (Square 1:1)', 'educational', 'Clean line-by-line reveal with soft keyboard strokes, ideal for Instagram feed & Facebook.', '{\"aspect_ratio\":\"1:1\",\"resolution\":\"1080p\",\"font_settings\":{\"fontFamily\":\"Inter, sans-serif\",\"fontSize\":44,\"fontWeight\":\"600\",\"textColor\":\"#E5E7EB\",\"textAlign\":\"left\",\"lineHeight\":1.6,\"letterSpacing\":0,\"shadow\":\"0 2px 8px rgba(0,0,0,0.7)\",\"padding\":48,\"maxWidthPercent\":88,\"positionY\":\"center\"},\"animation_settings\":{\"mode\":\"line\",\"speedMs\":220,\"wordPauseMs\":80,\"sentencePauseMs\":300,\"paragraphPauseMs\":600,\"startDelayMs\":800,\"endDelayMs\":2500,\"cursorStyle\":\"line\",\"cursorColor\":\"#EAB308\",\"cursorBlink\":true,\"textEntrance\":\"fade_in\"},\"audio_settings\":{\"profile\":\"soft\",\"volume\":0.7,\"enabled\":true,\"pitchVariation\":true,\"punctuationSound\":false,\"fadeInMs\":150,\"fadeOutMs\":500},\"background_settings\":{\"type\":\"color\",\"color\":\"#111827\",\"blur\":0,\"brightness\":1,\"contrast\":1,\"overlayOpacity\":0.2,\"overlayColor\":\"#000000\"},\"text_content\":\"3 Rules for High Impact Output:\\n\\n1. Deep focus beats multitasking.\\n2. Consistency compounds exponentially.\\n3. Publish before you feel ready.\"}', 1, NOW(), NOW());
INSERT INTO `templates` (`user_id`, `name`, `category`, `description`, `config`, `is_default`, `created_at`, `updated_at`) VALUES (1, 'Story Narration (Landscape 16:9)', 'story', 'Cinematic wide presentation with gentle typing cadence and atmospheric pacing.', '{\"aspect_ratio\":\"16:9\",\"resolution\":\"1080p\",\"font_settings\":{\"fontFamily\":\"Georgia, serif\",\"fontSize\":46,\"fontWeight\":\"400\",\"textColor\":\"#F9FAFB\",\"textAlign\":\"center\",\"lineHeight\":1.7,\"letterSpacing\":0.8,\"shadow\":\"0 4px 16px rgba(0,0,0,0.85)\",\"padding\":60,\"maxWidthPercent\":80,\"positionY\":\"center\"},\"animation_settings\":{\"mode\":\"sentence\",\"speedMs\":180,\"wordPauseMs\":100,\"sentencePauseMs\":500,\"paragraphPauseMs\":800,\"startDelayMs\":1000,\"endDelayMs\":3000,\"cursorStyle\":\"line\",\"cursorColor\":\"#FBBF24\",\"cursorBlink\":true,\"textEntrance\":\"fade_in\"},\"audio_settings\":{\"profile\":\"soft\",\"volume\":0.65,\"enabled\":true,\"pitchVariation\":true,\"punctuationSound\":true,\"fadeInMs\":300,\"fadeOutMs\":700},\"background_settings\":{\"type\":\"gradient\",\"gradientDirection\":\"to right\",\"gradientStart\":\"#0F172A\",\"gradientEnd\":\"#1E1B4B\",\"blur\":0,\"brightness\":1,\"contrast\":1,\"overlayOpacity\":0.4,\"overlayColor\":\"#000000\"},\"text_content\":\"It was a quiet morning when the idea first struck.\\n\\nNot with thunder, but with the subtle certainty that everything was about to change.\"}', 1, NOW(), NOW());

SET FOREIGN_KEY_CHECKS=1;
