-- Star Management Group: clean installation schema and default templates.
-- No admin password, SMTP secret, contact, campaign or chat data.
-- Import into an EMPTY database, then run php artisan star:admin your@email.com.
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS=0;

CREATE TABLE `users` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL,
  `email_verified_at` timestamp NULL DEFAULT NULL,
  `password` varchar(255) NOT NULL,
  `remember_token` varchar(100) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `is_admin` tinyint(1) NOT NULL DEFAULT 0,
  PRIMARY KEY (`id`),
  UNIQUE KEY `users_email_unique` (`email`),
  KEY `users_is_admin_index` (`is_admin`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `password_reset_tokens` (
  `email` varchar(255) NOT NULL,
  `token` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `sessions` (
  `id` varchar(255) NOT NULL,
  `user_id` bigint(20) unsigned DEFAULT NULL,
  `ip_address` varchar(45) DEFAULT NULL,
  `user_agent` text DEFAULT NULL,
  `payload` longtext 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;

CREATE TABLE `cache` (
  `key` varchar(255) NOT NULL,
  `value` mediumtext NOT NULL,
  `expiration` int(11) NOT NULL,
  PRIMARY KEY (`key`),
  KEY `cache_expiration_index` (`expiration`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `cache_locks` (
  `key` varchar(255) NOT NULL,
  `owner` varchar(255) NOT NULL,
  `expiration` int(11) NOT NULL,
  PRIMARY KEY (`key`),
  KEY `cache_locks_expiration_index` (`expiration`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `jobs` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `queue` varchar(255) NOT NULL,
  `payload` longtext 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;

CREATE TABLE `job_batches` (
  `id` varchar(255) NOT NULL,
  `name` varchar(255) NOT NULL,
  `total_jobs` int(11) NOT NULL,
  `pending_jobs` int(11) NOT NULL,
  `failed_jobs` int(11) NOT NULL,
  `failed_job_ids` longtext NOT NULL,
  `options` mediumtext 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;

CREATE TABLE `failed_jobs` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `uuid` varchar(255) NOT NULL,
  `connection` text NOT NULL,
  `queue` text NOT NULL,
  `payload` longtext NOT NULL,
  `exception` longtext 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;

CREATE TABLE `settings` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `key` varchar(255) NOT NULL,
  `value` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `settings_key_unique` (`key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `contacts` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `email` varchar(255) NOT NULL,
  `name` varchar(255) DEFAULT NULL,
  `status` varchar(24) NOT NULL DEFAULT 'unsubscribed',
  `consent_at` timestamp NULL DEFAULT NULL,
  `consent_source` varchar(255) DEFAULT NULL,
  `consent_text` text DEFAULT NULL,
  `unsubscribed_at` timestamp NULL DEFAULT NULL,
  `suppressed_at` timestamp NULL DEFAULT NULL,
  `unsubscribe_token` varchar(64) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `contacts_email_unique` (`email`),
  UNIQUE KEY `contacts_unsubscribe_token_unique` (`unsubscribe_token`),
  KEY `contacts_status_index` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `email_templates` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `slug` varchar(255) NOT NULL,
  `name` varchar(255) NOT NULL,
  `category` varchar(255) NOT NULL,
  `accent` varchar(16) NOT NULL,
  `image_url` text DEFAULT NULL,
  `subject` varchar(255) NOT NULL,
  `preheader` varchar(255) DEFAULT NULL,
  `heading` varchar(255) NOT NULL,
  `body` text NOT NULL,
  `cta_text` varchar(255) DEFAULT NULL,
  `cta_url` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `email_templates_slug_unique` (`slug`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `campaigns` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `template_id` bigint(20) unsigned NOT NULL,
  `created_by` bigint(20) unsigned DEFAULT NULL,
  `name` varchar(255) NOT NULL,
  `subject` varchar(255) NOT NULL,
  `preheader` varchar(255) DEFAULT NULL,
  `heading` varchar(255) NOT NULL,
  `body` text NOT NULL,
  `cta_text` varchar(255) DEFAULT NULL,
  `cta_url` text DEFAULT NULL,
  `image_url` text DEFAULT NULL,
  `status` varchar(24) NOT NULL DEFAULT 'draft',
  `queued_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `campaigns_template_id_foreign` (`template_id`),
  KEY `campaigns_created_by_foreign` (`created_by`),
  KEY `campaigns_status_index` (`status`),
  CONSTRAINT `campaigns_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  CONSTRAINT `campaigns_template_id_foreign` FOREIGN KEY (`template_id`) REFERENCES `email_templates` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `deliveries` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `campaign_id` bigint(20) unsigned NOT NULL,
  `contact_id` bigint(20) unsigned DEFAULT NULL,
  `recipient` varchar(255) NOT NULL,
  `is_test` tinyint(1) NOT NULL DEFAULT 0,
  `status` varchar(24) NOT NULL DEFAULT 'queued',
  `error` text DEFAULT NULL,
  `message_id` varchar(255) DEFAULT NULL,
  `accepted_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `deliveries_campaign_id_contact_id_unique` (`campaign_id`,`contact_id`),
  KEY `deliveries_campaign_id_foreign` (`campaign_id`),
  KEY `deliveries_contact_id_foreign` (`contact_id`),
  KEY `deliveries_status_index` (`status`),
  CONSTRAINT `deliveries_campaign_id_foreign` FOREIGN KEY (`campaign_id`) REFERENCES `campaigns` (`id`) ON DELETE CASCADE,
  CONSTRAINT `deliveries_contact_id_foreign` FOREIGN KEY (`contact_id`) REFERENCES `contacts` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `inquiries` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `full_name` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL,
  `phone` varchar(255) DEFAULT NULL,
  `event_type` varchar(255) DEFAULT NULL,
  `talent` varchar(255) DEFAULT NULL,
  `event_date` date DEFAULT NULL,
  `location` varchar(255) DEFAULT NULL,
  `budget` varchar(255) DEFAULT NULL,
  `message` text NOT NULL,
  `consent` tinyint(1) NOT NULL DEFAULT 0,
  `status` varchar(24) NOT NULL DEFAULT 'new',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `inquiries_status_index` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `conversations` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL,
  `token` varchar(64) NOT NULL,
  `status` varchar(24) NOT NULL DEFAULT 'open',
  `last_message_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `conversations_token_unique` (`token`),
  KEY `conversations_status_index` (`status`),
  KEY `conversations_last_message_at_index` (`last_message_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `chat_messages` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `conversation_id` bigint(20) unsigned NOT NULL,
  `user_id` bigint(20) unsigned DEFAULT NULL,
  `sender` varchar(24) NOT NULL,
  `body` text NOT NULL,
  `read_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `chat_messages_conversation_id_foreign` (`conversation_id`),
  KEY `chat_messages_user_id_foreign` (`user_id`),
  CONSTRAINT `chat_messages_conversation_id_foreign` FOREIGN KEY (`conversation_id`) REFERENCES `conversations` (`id`) ON DELETE CASCADE,
  CONSTRAINT `chat_messages_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `migrations` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `migration` varchar(255) 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');
INSERT INTO `migrations` (`id`,`migration`,`batch`) VALUES ('2','0001_01_01_000001_create_cache_table','1');
INSERT INTO `migrations` (`id`,`migration`,`batch`) VALUES ('3','0001_01_01_000002_create_jobs_table','1');
INSERT INTO `migrations` (`id`,`migration`,`batch`) VALUES ('4','2026_11_15_000100_create_star_management_tables','1');
INSERT INTO `email_templates` (`id`,`slug`,`name`,`category`,`accent`,`image_url`,`subject`,`preheader`,`heading`,`body`,`cta_text`,`cta_url`,`created_at`,`updated_at`) VALUES ('1','booking-introduction','Booking introduction','Outreach','#F56D50','/assets/concert.jpg','Make your next moment unforgettable','Thoughtful talent connections for exceptional occasions.','An extraordinary event starts with the right connection.','Every occasion has a story. The right talent can help make yours unforgettable.\n\nStar Management Group coordinates booking inquiries for appearances, live performances and brand partnerships. Tell us what you are planning, and we will help explore possibilities aligned with your audience, timeline and budget.\n\nAvailability and representation are confirmed individually. We would love to hear about your next moment.','Discuss your event','https://starmanagementgroup.online/contact','2026-11-15 06:43:34','2026-11-15 06:43:34');
INSERT INTO `email_templates` (`id`,`slug`,`name`,`category`,`accent`,`image_url`,`subject`,`preheader`,`heading`,`body`,`cta_text`,`cta_url`,`created_at`,`updated_at`) VALUES ('2','talent-spotlight','Talent spotlight','Editorial','#257A76','/assets/portrait.jpg','Fresh inspiration for your next collaboration','Explore the possibilities of a thoughtful talent partnership.','A fresh perspective. A memorable connection.','The strongest collaborations begin with a shared idea. From a captivating speaker to an engaging creative partnership, exceptional talent brings a distinctive perspective to a brand or event.\n\nUse this spotlight to introduce your selected talent, their background and the kind of collaboration you have in mind. Replace this draft with verified information and confirm booking availability before sharing.\n\nOur photographs are illustrative and do not imply representation or affiliation.','Explore a partnership','https://starmanagementgroup.online/contact','2026-11-15 06:43:34','2026-11-15 06:43:34');
INSERT INTO `email_templates` (`id`,`slug`,`name`,`category`,`accent`,`image_url`,`subject`,`preheader`,`heading`,`body`,`cta_text`,`cta_url`,`created_at`,`updated_at`) VALUES ('3','event-invitation','Event invitation','Events','#72558C','/assets/crowd.jpg','An invitation to something memorable','Good company. Fresh ideas. A moment worth sharing.','There is a place for you in the room.','Some moments are better shared. We would be delighted to invite you to our upcoming gathering.\n\nAdd your confirmed event name, date, venue and guest information here before sending. Let guests know what to expect, who the occasion is for and whether registration is required.\n\nWe look forward to bringing the right people together. Reply with any questions or accessibility requirements.','Request event details','https://starmanagementgroup.online/contact','2026-11-15 06:43:34','2026-11-15 06:43:34');
INSERT INTO `email_templates` (`id`,`slug`,`name`,`category`,`accent`,`image_url`,`subject`,`preheader`,`heading`,`body`,`cta_text`,`cta_url`,`created_at`,`updated_at`) VALUES ('4','casting-announcement','Casting announcement','Casting','#366BAB','/assets/camera.jpg','A new opportunity to bring your talent forward','Clear briefs. Thoughtful casting. Creative possibilities.','The next role starts with a conversation.','Creative projects need the right people behind them. Share your casting opportunity with a clear, verified brief that helps talent understand the project and decide whether it is a good fit.\n\nReplace this draft with confirmed role requirements, production dates, location, compensation and submission instructions. Include the application deadline and the relevant contact.\n\nApplications are reviewed individually. No role or selection is guaranteed.','Ask about the brief','https://starmanagementgroup.online/contact','2026-11-15 06:43:34','2026-11-15 06:43:34');
INSERT INTO `email_templates` (`id`,`slug`,`name`,`category`,`accent`,`image_url`,`subject`,`preheader`,`heading`,`body`,`cta_text`,`cta_url`,`created_at`,`updated_at`) VALUES ('5','booking-follow-up','Booking follow-up','Follow-up','#AD782C','/assets/stage.jpg','A quick follow-up on your event plans','Let us keep the conversation moving at your pace.','Good communication. Great possibilities.','Thank you for considering Star Management Group for your upcoming event or collaboration. We are following up to see whether your plans have developed and if there is any additional information we can provide.\n\nShare an updated date, venue, audience or budget whenever you are ready. We will use those details to explore suitable options and confirm availability.\n\nThere is no pressure to decide today. We are here when the time is right.','Continue the conversation','https://starmanagementgroup.online/contact','2026-11-15 06:43:34','2026-11-15 06:43:34');

SET FOREIGN_KEY_CHECKS=1;
-- Run php artisan db:seed to add safe site defaults without overwriting edits.
