-- Pronto Laravel Backend full MySQL import
-- Generated from verified demo SQLite database.
SET FOREIGN_KEY_CHECKS=0;
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";

DROP TABLE IF EXISTS `wallet_transactions`;
DROP TABLE IF EXISTS `wallet_accounts`;
DROP TABLE IF EXISTS `users`;
DROP TABLE IF EXISTS `user_devices`;
DROP TABLE IF EXISTS `user_consents`;
DROP TABLE IF EXISTS `tax_rules`;
DROP TABLE IF EXISTS `support_tickets`;
DROP TABLE IF EXISTS `support_messages`;
DROP TABLE IF EXISTS `staff_profiles`;
DROP TABLE IF EXISTS `sos_alerts`;
DROP TABLE IF EXISTS `skills`;
DROP TABLE IF EXISTS `services`;
DROP TABLE IF EXISTS `service_variants`;
DROP TABLE IF EXISTS `service_skill_requirements`;
DROP TABLE IF EXISTS `service_prices`;
DROP TABLE IF EXISTS `service_packages`;
DROP TABLE IF EXISTS `service_checklist_items`;
DROP TABLE IF EXISTS `service_categories`;
DROP TABLE IF EXISTS `service_availability`;
DROP TABLE IF EXISTS `service_areas`;
DROP TABLE IF EXISTS `service_addons`;
DROP TABLE IF EXISTS `reviews`;
DROP TABLE IF EXISTS `refunds`;
DROP TABLE IF EXISTS `referral_rewards`;
DROP TABLE IF EXISTS `referral_leads`;
DROP TABLE IF EXISTS `referral_codes`;
DROP TABLE IF EXISTS `recurring_sessions`;
DROP TABLE IF EXISTS `recurring_plans`;
DROP TABLE IF EXISTS `rapid_coin_transactions`;
DROP TABLE IF EXISTS `quotes`;
DROP TABLE IF EXISTS `professionals`;
DROP TABLE IF EXISTS `professional_skills`;
DROP TABLE IF EXISTS `professional_shifts`;
DROP TABLE IF EXISTS `professional_locations`;
DROP TABLE IF EXISTS `professional_earnings`;
DROP TABLE IF EXISTS `professional_documents`;
DROP TABLE IF EXISTS `professional_availabilities`;
DROP TABLE IF EXISTS `professional_applications`;
DROP TABLE IF EXISTS `price_books`;
DROP TABLE IF EXISTS `personal_access_tokens`;
DROP TABLE IF EXISTS `payout_items`;
DROP TABLE IF EXISTS `payout_batches`;
DROP TABLE IF EXISTS `payments`;
DROP TABLE IF EXISTS `payment_webhooks`;
DROP TABLE IF EXISTS `payment_gateways`;
DROP TABLE IF EXISTS `payment_attempts`;
DROP TABLE IF EXISTS `password_resets`;
DROP TABLE IF EXISTS `onboarding_screens`;
DROP TABLE IF EXISTS `notification_templates`;
DROP TABLE IF EXISTS `migrations`;
DROP TABLE IF EXISTS `map_settings`;
DROP TABLE IF EXISTS `localities`;
DROP TABLE IF EXISTS `language_strings`;
DROP TABLE IF EXISTS `invoices`;
DROP TABLE IF EXISTS `hubs`;
DROP TABLE IF EXISTS `fee_rules`;
DROP TABLE IF EXISTS `faqs`;
DROP TABLE IF EXISTS `failed_jobs`;
DROP TABLE IF EXISTS `deals`;
DROP TABLE IF EXISTS `customer_addresses`;
DROP TABLE IF EXISTS `coupons`;
DROP TABLE IF EXISTS `complaints`;
DROP TABLE IF EXISTS `communication_logs`;
DROP TABLE IF EXISTS `cms_pages`;
DROP TABLE IF EXISTS `cities`;
DROP TABLE IF EXISTS `carts`;
DROP TABLE IF EXISTS `cart_items`;
DROP TABLE IF EXISTS `cart_item_addons`;
DROP TABLE IF EXISTS `buddies`;
DROP TABLE IF EXISTS `bookings`;
DROP TABLE IF EXISTS `booking_status_histories`;
DROP TABLE IF EXISTS `booking_items`;
DROP TABLE IF EXISTS `booking_assignments`;
DROP TABLE IF EXISTS `auth_otps`;
DROP TABLE IF EXISTS `audit_logs`;
DROP TABLE IF EXISTS `assignment_offers`;
DROP TABLE IF EXISTS `app_configs`;
DROP TABLE IF EXISTS `app_banners`;
DROP TABLE IF EXISTS `analytics_events`;
DROP TABLE IF EXISTS `admin_roles`;
DROP TABLE IF EXISTS `admin_role_permissions`;
DROP TABLE IF EXISTS `admin_permissions`;
DROP TABLE IF EXISTS `account_deletion_requests`;

CREATE TABLE `account_deletion_requests` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `user_id` BIGINT NULL,
  `phone` VARCHAR(255) NOT NULL,
  `status` VARCHAR(255) NOT NULL DEFAULT 'requested',
  `reason` TEXT NULL,
  `requested_at` VARCHAR(255) NOT NULL,
  `completed_at` VARCHAR(255) NULL,
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `account_deletion_requests_status_index` (`status`),
  KEY `account_deletion_requests_phone_index` (`phone`),
  KEY `account_deletion_requests_user_id_index` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `admin_permissions` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `module` VARCHAR(255) NOT NULL,
  `name` VARCHAR(255) NOT NULL,
  `slug` VARCHAR(255) NOT NULL,
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `admin_permissions_slug_unique` (`slug`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `admin_role_permissions` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `admin_role_id` BIGINT NOT NULL,
  `admin_permission_id` BIGINT NOT NULL,
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `admin_role_permissions_admin_permission_id_index` (`admin_permission_id`),
  KEY `admin_role_permissions_admin_role_id_index` (`admin_role_id`),
  UNIQUE KEY `admin_role_permissions_admin_role_id_admin_permission_id_unique` (`admin_role_id`, `admin_permission_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `admin_roles` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `name` VARCHAR(255) NOT NULL,
  `slug` VARCHAR(255) NOT NULL,
  `description` TEXT NULL,
  `status` VARCHAR(255) NOT NULL DEFAULT 'active',
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `admin_roles_status_index` (`status`),
  UNIQUE KEY `admin_roles_slug_unique` (`slug`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `analytics_events` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `user_id` BIGINT NULL,
  `event_name` VARCHAR(255) NOT NULL,
  `event_properties_json` JSON NULL,
  `device_id` VARCHAR(255) NULL,
  `occurred_at` VARCHAR(255) NOT NULL,
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `analytics_events_occurred_at_index` (`occurred_at`),
  KEY `analytics_events_event_name_index` (`event_name`),
  KEY `analytics_events_user_id_index` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `app_banners` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `title` VARCHAR(255) NOT NULL,
  `subtitle` VARCHAR(255) NULL,
  `image_path` VARCHAR(255) NOT NULL,
  `deep_link` VARCHAR(255) NULL,
  `sort_order` BIGINT NOT NULL DEFAULT '0',
  `starts_at` VARCHAR(255) NULL,
  `ends_at` VARCHAR(255) NULL,
  `status` VARCHAR(255) NOT NULL DEFAULT 'active',
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `app_banners_status_index` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `app_configs` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `key` VARCHAR(255) NOT NULL,
  `value_json` JSON NOT NULL,
  `description` VARCHAR(255) NULL,
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `app_configs_key_unique` (`key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `assignment_offers` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `booking_id` BIGINT NOT NULL,
  `professional_id` BIGINT NOT NULL,
  `score` DECIMAL(12,2) NOT NULL DEFAULT '0',
  `status` VARCHAR(255) NOT NULL DEFAULT 'offered',
  `offered_at` VARCHAR(255) NOT NULL,
  `expires_at` VARCHAR(255) NOT NULL,
  `responded_at` VARCHAR(255) NULL,
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `assignment_offers_status_index` (`status`),
  KEY `assignment_offers_professional_id_index` (`professional_id`),
  KEY `assignment_offers_booking_id_index` (`booking_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `audit_logs` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `actor_type` VARCHAR(255) NULL,
  `actor_id` BIGINT NULL,
  `action` VARCHAR(255) NOT NULL,
  `auditable_type` VARCHAR(255) NULL,
  `auditable_id` BIGINT NULL,
  `old_values_json` JSON NULL,
  `new_values_json` JSON NULL,
  `ip_address` VARCHAR(255) NULL,
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `audit_logs_action_index` (`action`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `auth_otps` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `phone` VARCHAR(255) NOT NULL,
  `purpose` VARCHAR(255) NOT NULL DEFAULT 'login',
  `otp_hash` VARCHAR(255) NOT NULL,
  `expires_at` VARCHAR(255) NOT NULL,
  `verified_at` VARCHAR(255) NULL,
  `attempts` BIGINT NOT NULL DEFAULT '0',
  `ip_address` VARCHAR(255) NULL,
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `auth_otps_phone_index` (`phone`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `booking_assignments` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `booking_id` BIGINT NOT NULL,
  `professional_id` BIGINT NOT NULL,
  `assigned_by_type` VARCHAR(255) NOT NULL DEFAULT 'system',
  `assigned_by_id` BIGINT NULL,
  `assignment_type` VARCHAR(255) NOT NULL DEFAULT 'auto',
  `status` VARCHAR(255) NOT NULL DEFAULT 'assigned',
  `assigned_at` VARCHAR(255) NOT NULL,
  `accepted_at` VARCHAR(255) NULL,
  `arrived_at` VARCHAR(255) NULL,
  `started_at` VARCHAR(255) NULL,
  `completed_at` VARCHAR(255) NULL,
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `booking_assignments_status_index` (`status`),
  KEY `booking_assignments_professional_id_index` (`professional_id`),
  KEY `booking_assignments_booking_id_index` (`booking_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `booking_items` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `booking_id` BIGINT NOT NULL,
  `service_id` BIGINT NOT NULL,
  `variant_id` BIGINT NULL,
  `service_name_snapshot` VARCHAR(255) NOT NULL,
  `quantity` BIGINT NOT NULL DEFAULT '1',
  `duration_minutes` BIGINT NOT NULL DEFAULT '60',
  `price_snapshot_json` JSON NULL,
  `status` VARCHAR(255) NOT NULL DEFAULT 'pending',
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `booking_items_status_index` (`status`),
  KEY `booking_items_variant_id_index` (`variant_id`),
  KEY `booking_items_service_id_index` (`service_id`),
  KEY `booking_items_booking_id_index` (`booking_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `booking_status_histories` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `booking_id` BIGINT NOT NULL,
  `from_status` VARCHAR(255) NULL,
  `to_status` VARCHAR(255) NOT NULL,
  `actor_type` VARCHAR(255) NULL,
  `actor_id` BIGINT NULL,
  `reason` VARCHAR(255) NULL,
  `metadata_json` JSON NULL,
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `booking_status_histories_booking_id_index` (`booking_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `bookings` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `booking_number` VARCHAR(255) NOT NULL,
  `user_id` BIGINT NOT NULL,
  `address_id` BIGINT NOT NULL,
  `quote_id` BIGINT NULL,
  `recurring_plan_id` BIGINT NULL,
  `booking_type` VARCHAR(255) NOT NULL DEFAULT 'instant',
  `scheduled_start_at` VARCHAR(255) NULL,
  `scheduled_end_at` VARCHAR(255) NULL,
  `status` VARCHAR(255) NOT NULL DEFAULT 'confirmed',
  `payment_status` VARCHAR(255) NOT NULL DEFAULT 'unpaid',
  `assignment_status` VARCHAR(255) NOT NULL DEFAULT 'unassigned',
  `subtotal` DECIMAL(12,2) NOT NULL DEFAULT '0',
  `fees_total` DECIMAL(12,2) NOT NULL DEFAULT '0',
  `discount_total` DECIMAL(12,2) NOT NULL DEFAULT '0',
  `tax_total` DECIMAL(12,2) NOT NULL DEFAULT '0',
  `payable_total` DECIMAL(12,2) NOT NULL DEFAULT '0',
  `customer_notes` TEXT NULL,
  `cancellation_reason` VARCHAR(255) NULL,
  `cancelled_by_type` VARCHAR(255) NULL,
  `cancelled_by_id` BIGINT NULL,
  `cancelled_at` VARCHAR(255) NULL,
  `completed_at` VARCHAR(255) NULL,
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `bookings_assignment_status_index` (`assignment_status`),
  KEY `bookings_payment_status_index` (`payment_status`),
  KEY `bookings_status_index` (`status`),
  KEY `bookings_scheduled_start_at_index` (`scheduled_start_at`),
  KEY `bookings_booking_type_index` (`booking_type`),
  KEY `bookings_recurring_plan_id_index` (`recurring_plan_id`),
  KEY `bookings_quote_id_index` (`quote_id`),
  KEY `bookings_address_id_index` (`address_id`),
  KEY `bookings_user_id_index` (`user_id`),
  UNIQUE KEY `bookings_booking_number_unique` (`booking_number`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `buddies` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `user_id` BIGINT NULL,
  `buddy_code` VARCHAR(255) NOT NULL,
  `pan_encrypted` TEXT NULL,
  `bank_account_encrypted` TEXT NULL,
  `bank_ifsc` VARCHAR(255) NULL,
  `status` VARCHAR(255) NOT NULL DEFAULT 'active',
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `buddies_status_index` (`status`),
  UNIQUE KEY `buddies_buddy_code_unique` (`buddy_code`),
  KEY `buddies_user_id_index` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `cart_item_addons` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `cart_item_id` BIGINT NOT NULL,
  `addon_id` BIGINT NOT NULL,
  `quantity` BIGINT NOT NULL DEFAULT '1',
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `cart_item_addons_addon_id_index` (`addon_id`),
  KEY `cart_item_addons_cart_item_id_index` (`cart_item_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `cart_items` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `cart_id` BIGINT NOT NULL,
  `service_id` BIGINT NOT NULL,
  `variant_id` BIGINT NULL,
  `quantity` BIGINT NOT NULL DEFAULT '1',
  `duration_minutes` BIGINT NULL,
  `notes` TEXT NULL,
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `cart_items_variant_id_index` (`variant_id`),
  KEY `cart_items_service_id_index` (`service_id`),
  KEY `cart_items_cart_id_index` (`cart_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `carts` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `user_id` BIGINT NOT NULL,
  `address_id` BIGINT NULL,
  `booking_type` VARCHAR(255) NOT NULL DEFAULT 'instant',
  `scheduled_start_at` VARCHAR(255) NULL,
  `recurring_json` JSON NULL,
  `coupon_code` VARCHAR(255) NULL,
  `use_wallet` TINYINT(1) NOT NULL DEFAULT '0',
  `status` VARCHAR(255) NOT NULL DEFAULT 'active',
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `carts_status_index` (`status`),
  KEY `carts_booking_type_index` (`booking_type`),
  KEY `carts_address_id_index` (`address_id`),
  KEY `carts_user_id_index` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `cities` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `name` VARCHAR(255) NOT NULL,
  `slug` VARCHAR(255) NOT NULL,
  `state` VARCHAR(255) NULL,
  `country` VARCHAR(255) NOT NULL DEFAULT 'India',
  `timezone` VARCHAR(255) NOT NULL DEFAULT 'Asia/Kolkata',
  `status` VARCHAR(255) NOT NULL DEFAULT 'active',
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `cities_status_index` (`status`),
  UNIQUE KEY `cities_slug_unique` (`slug`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `cms_pages` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `slug` VARCHAR(255) NOT NULL,
  `title` VARCHAR(255) NOT NULL,
  `body_html` LONGTEXT NOT NULL,
  `version` VARCHAR(255) NOT NULL DEFAULT '1.0',
  `status` VARCHAR(255) NOT NULL DEFAULT 'published',
  `published_at` VARCHAR(255) NULL,
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `cms_pages_status_index` (`status`),
  UNIQUE KEY `cms_pages_slug_unique` (`slug`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `communication_logs` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `user_id` BIGINT NULL,
  `channel` VARCHAR(255) NOT NULL,
  `template_key` VARCHAR(255) NULL,
  `recipient` VARCHAR(255) NOT NULL,
  `payload_json` JSON NULL,
  `provider` VARCHAR(255) NOT NULL DEFAULT 'local',
  `provider_reference` VARCHAR(255) NULL,
  `status` VARCHAR(255) NOT NULL DEFAULT 'queued',
  `sent_at` VARCHAR(255) NULL,
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `communication_logs_status_index` (`status`),
  KEY `communication_logs_user_id_index` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `complaints` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `complaint_number` VARCHAR(255) NOT NULL,
  `user_id` BIGINT NULL,
  `booking_id` BIGINT NULL,
  `professional_id` BIGINT NULL,
  `complaint_type` VARCHAR(255) NOT NULL,
  `description` TEXT NOT NULL,
  `priority` VARCHAR(255) NOT NULL DEFAULT 'normal',
  `status` VARCHAR(255) NOT NULL DEFAULT 'open',
  `resolution` TEXT NULL,
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `complaints_status_index` (`status`),
  KEY `complaints_priority_index` (`priority`),
  KEY `complaints_professional_id_index` (`professional_id`),
  KEY `complaints_booking_id_index` (`booking_id`),
  KEY `complaints_user_id_index` (`user_id`),
  UNIQUE KEY `complaints_complaint_number_unique` (`complaint_number`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `coupons` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `code` VARCHAR(255) NOT NULL,
  `description` VARCHAR(255) NULL,
  `discount_type` VARCHAR(255) NOT NULL DEFAULT 'fixed',
  `discount_value` DECIMAL(12,2) NOT NULL DEFAULT '0',
  `max_discount` DECIMAL(12,2) NULL,
  `min_order_amount` DECIMAL(12,2) NULL,
  `starts_at` VARCHAR(255) NULL,
  `ends_at` VARCHAR(255) NULL,
  `usage_limit` BIGINT NULL,
  `per_user_limit` BIGINT NULL,
  `status` VARCHAR(255) NOT NULL DEFAULT 'active',
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `coupons_status_index` (`status`),
  UNIQUE KEY `coupons_code_unique` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `customer_addresses` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `user_id` BIGINT NOT NULL,
  `city_id` BIGINT NULL,
  `locality_id` BIGINT NULL,
  `label` VARCHAR(255) NOT NULL DEFAULT 'Home',
  `address_line_1` VARCHAR(255) NOT NULL,
  `address_line_2` VARCHAR(255) NULL,
  `landmark` VARCHAR(255) NULL,
  `pincode` VARCHAR(255) NULL,
  `lat` DECIMAL(10,7) NULL,
  `lng` DECIMAL(10,7) NULL,
  `society_name` VARCHAR(255) NULL,
  `floor` VARCHAR(255) NULL,
  `gate_instructions` TEXT NULL,
  `has_pets` TINYINT(1) NOT NULL DEFAULT '0',
  `is_default` TINYINT(1) NOT NULL DEFAULT '0',
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `customer_addresses_locality_id_index` (`locality_id`),
  KEY `customer_addresses_city_id_index` (`city_id`),
  KEY `customer_addresses_user_id_index` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `deals` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `title` VARCHAR(255) NOT NULL,
  `description` TEXT NULL,
  `image_path` VARCHAR(255) NULL,
  `deal_type` VARCHAR(255) NOT NULL DEFAULT 'flat',
  `value` DECIMAL(12,2) NOT NULL DEFAULT '0',
  `starts_at` VARCHAR(255) NULL,
  `ends_at` VARCHAR(255) NULL,
  `status` VARCHAR(255) NOT NULL DEFAULT 'active',
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `deals_status_index` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `failed_jobs` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `uuid` VARCHAR(255) NOT NULL,
  `connection` TEXT NOT NULL,
  `queue` TEXT NOT NULL,
  `payload` TEXT NOT NULL,
  `exception` TEXT NOT NULL,
  `failed_at` VARCHAR(255) 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 `faqs` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `question` VARCHAR(255) NOT NULL,
  `answer` TEXT NOT NULL,
  `category` VARCHAR(255) NULL,
  `sort_order` BIGINT NOT NULL DEFAULT '0',
  `status` VARCHAR(255) NOT NULL DEFAULT 'active',
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `faqs_status_index` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `fee_rules` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `name` VARCHAR(255) NOT NULL,
  `fee_type` VARCHAR(255) NOT NULL,
  `calculation_type` VARCHAR(255) NOT NULL DEFAULT 'fixed',
  `value` DECIMAL(12,2) NOT NULL DEFAULT '0',
  `conditions_json` JSON NULL,
  `status` VARCHAR(255) NOT NULL DEFAULT 'active',
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `fee_rules_status_index` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `hubs` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `city_id` BIGINT NOT NULL,
  `locality_id` BIGINT NULL,
  `name` VARCHAR(255) NOT NULL,
  `address` TEXT NULL,
  `lat` DECIMAL(10,7) NULL,
  `lng` DECIMAL(10,7) NULL,
  `status` VARCHAR(255) NOT NULL DEFAULT 'active',
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `hubs_status_index` (`status`),
  KEY `hubs_locality_id_index` (`locality_id`),
  KEY `hubs_city_id_index` (`city_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `invoices` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `booking_id` BIGINT NOT NULL,
  `user_id` BIGINT NOT NULL,
  `invoice_number` VARCHAR(255) NOT NULL,
  `gst_number` VARCHAR(255) NULL,
  `subtotal` DECIMAL(12,2) NOT NULL DEFAULT '0',
  `tax_total` DECIMAL(12,2) NOT NULL DEFAULT '0',
  `total` DECIMAL(12,2) NOT NULL DEFAULT '0',
  `pdf_path` VARCHAR(255) NULL,
  `issued_at` VARCHAR(255) NOT NULL,
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `invoices_invoice_number_unique` (`invoice_number`),
  KEY `invoices_user_id_index` (`user_id`),
  KEY `invoices_booking_id_index` (`booking_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `language_strings` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `locale` VARCHAR(255) NOT NULL DEFAULT 'en',
  `group_name` VARCHAR(255) NOT NULL DEFAULT 'app',
  `translation_key` VARCHAR(255) NOT NULL,
  `translation_value` TEXT NOT NULL,
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `language_strings_locale_index` (`locale`),
  UNIQUE KEY `language_strings_unique` (`locale`, `group_name`, `translation_key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `localities` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `city_id` BIGINT NOT NULL,
  `name` VARCHAR(255) NOT NULL,
  `slug` VARCHAR(255) NOT NULL,
  `pincode` VARCHAR(255) NULL,
  `status` VARCHAR(255) NOT NULL DEFAULT 'active',
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `localities_status_index` (`status`),
  KEY `localities_city_id_index` (`city_id`),
  UNIQUE KEY `localities_city_id_slug_unique` (`city_id`, `slug`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `map_settings` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `provider` VARCHAR(255) NOT NULL DEFAULT 'google',
  `api_key` VARCHAR(255) NULL,
  `default_lat` DECIMAL(10,7) NULL,
  `default_lng` DECIMAL(10,7) NULL,
  `default_zoom` BIGINT NOT NULL DEFAULT '12',
  `status` VARCHAR(255) NOT NULL DEFAULT 'active',
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `map_settings_status_index` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `migrations` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `migration` VARCHAR(255) NOT NULL,
  `batch` BIGINT NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
('1', '2014_10_12_000000_create_users_table', '1'),
('2', '2014_10_12_100000_create_password_resets_table', '1'),
('3', '2019_08_19_000000_create_failed_jobs_table', '1'),
('4', '2019_12_14_000001_create_personal_access_tokens_table', '1'),
('5', '2026_06_08_000001_create_pronto_domain_tables', '1'),
('6', '2026_06_08_000002_create_pronto_operations_tables', '1'),
('7', '2026_06_08_000003_create_rapidsewa_admin_tables', '1');

CREATE TABLE `notification_templates` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `channel` VARCHAR(255) NOT NULL,
  `template_key` VARCHAR(255) NOT NULL,
  `subject` VARCHAR(255) NULL,
  `body` LONGTEXT NOT NULL,
  `variables_json` JSON NULL,
  `status` VARCHAR(255) NOT NULL DEFAULT 'active',
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `notification_templates_status_index` (`status`),
  UNIQUE KEY `notification_templates_channel_template_key_unique` (`channel`, `template_key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `onboarding_screens` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `title` VARCHAR(255) NOT NULL,
  `content` TEXT NOT NULL,
  `image_path` VARCHAR(255) NULL,
  `sort_order` BIGINT NOT NULL DEFAULT '0',
  `status` VARCHAR(255) NOT NULL DEFAULT 'active',
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `onboarding_screens_status_index` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `password_resets` (
  `email` VARCHAR(255) NOT NULL,
  `token` VARCHAR(255) NOT NULL,
  `created_at` VARCHAR(255) NULL,
  KEY `password_resets_email_index` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `payment_attempts` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `payment_id` BIGINT NOT NULL,
  `gateway_payment_id` VARCHAR(255) NULL,
  `method` VARCHAR(255) NOT NULL DEFAULT 'upi',
  `status` VARCHAR(255) NOT NULL DEFAULT 'created',
  `response_json` JSON NULL,
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `payment_attempts_status_index` (`status`),
  KEY `payment_attempts_gateway_payment_id_index` (`gateway_payment_id`),
  KEY `payment_attempts_payment_id_index` (`payment_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `payment_gateways` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `name` VARCHAR(255) NOT NULL,
  `slug` VARCHAR(255) NOT NULL,
  `mode` VARCHAR(255) NOT NULL DEFAULT 'test',
  `key_id` VARCHAR(255) NULL,
  `key_secret` TEXT NULL,
  `config_json` JSON NULL,
  `status` VARCHAR(255) NOT NULL DEFAULT 'inactive',
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `payment_gateways_status_index` (`status`),
  UNIQUE KEY `payment_gateways_slug_unique` (`slug`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `payment_webhooks` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `gateway` VARCHAR(255) NOT NULL,
  `event_type` VARCHAR(255) NOT NULL,
  `gateway_event_id` VARCHAR(255) NULL,
  `payload_json` JSON NOT NULL,
  `signature_valid` TINYINT(1) NOT NULL DEFAULT '0',
  `processed_at` VARCHAR(255) NULL,
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `payment_webhooks_gateway_event_id_index` (`gateway_event_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `payments` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `payment_number` VARCHAR(255) NOT NULL,
  `user_id` BIGINT NOT NULL,
  `booking_id` BIGINT NULL,
  `quote_id` BIGINT NULL,
  `gateway` VARCHAR(255) NOT NULL DEFAULT 'local',
  `gateway_order_id` VARCHAR(255) NULL,
  `amount` DECIMAL(12,2) NOT NULL,
  `currency` VARCHAR(255) NOT NULL DEFAULT 'INR',
  `status` VARCHAR(255) NOT NULL DEFAULT 'created',
  `paid_at` VARCHAR(255) NULL,
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `payments_status_index` (`status`),
  KEY `payments_gateway_order_id_index` (`gateway_order_id`),
  KEY `payments_quote_id_index` (`quote_id`),
  KEY `payments_booking_id_index` (`booking_id`),
  KEY `payments_user_id_index` (`user_id`),
  UNIQUE KEY `payments_payment_number_unique` (`payment_number`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `payout_batches` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `batch_number` VARCHAR(255) NOT NULL,
  `period_start` DATE NOT NULL,
  `period_end` DATE NOT NULL,
  `total_amount` DECIMAL(12,2) NOT NULL DEFAULT '0',
  `status` VARCHAR(255) NOT NULL DEFAULT 'draft',
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `payout_batches_status_index` (`status`),
  UNIQUE KEY `payout_batches_batch_number_unique` (`batch_number`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `payout_items` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `payout_batch_id` BIGINT NOT NULL,
  `professional_id` BIGINT NULL,
  `buddy_id` BIGINT NULL,
  `amount` DECIMAL(12,2) NOT NULL,
  `status` VARCHAR(255) NOT NULL DEFAULT 'pending',
  `bank_reference` VARCHAR(255) NULL,
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `payout_items_status_index` (`status`),
  KEY `payout_items_buddy_id_index` (`buddy_id`),
  KEY `payout_items_professional_id_index` (`professional_id`),
  KEY `payout_items_payout_batch_id_index` (`payout_batch_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `personal_access_tokens` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `tokenable_type` VARCHAR(255) NOT NULL,
  `tokenable_id` BIGINT NOT NULL,
  `name` VARCHAR(255) NOT NULL,
  `token` VARCHAR(255) NOT NULL,
  `abilities` TEXT NULL,
  `last_used_at` VARCHAR(255) NULL,
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `personal_access_tokens_token_unique` (`token`),
  KEY `personal_access_tokens_tokenable_type_tokenable_id_index` (`tokenable_type`, `tokenable_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `price_books` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `name` VARCHAR(255) NOT NULL,
  `city_id` BIGINT NULL,
  `starts_at` VARCHAR(255) NULL,
  `ends_at` VARCHAR(255) NULL,
  `status` VARCHAR(255) NOT NULL DEFAULT 'active',
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `price_books_status_index` (`status`),
  KEY `price_books_city_id_index` (`city_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `professional_applications` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `professional_id` BIGINT NULL,
  `name` VARCHAR(255) NOT NULL,
  `phone` VARCHAR(255) NOT NULL,
  `gender` VARCHAR(255) NULL,
  `city_id` BIGINT NULL,
  `source` VARCHAR(255) NOT NULL DEFAULT 'app',
  `referral_code` VARCHAR(255) NULL,
  `status` VARCHAR(255) NOT NULL DEFAULT 'lead',
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `professional_applications_status_index` (`status`),
  KEY `professional_applications_referral_code_index` (`referral_code`),
  KEY `professional_applications_city_id_index` (`city_id`),
  KEY `professional_applications_phone_index` (`phone`),
  KEY `professional_applications_professional_id_index` (`professional_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `professional_availabilities` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `professional_id` BIGINT NOT NULL,
  `day_of_week` BIGINT NOT NULL,
  `start_time` TIME NOT NULL,
  `end_time` TIME NOT NULL,
  `status` VARCHAR(255) NOT NULL DEFAULT 'active',
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `professional_availabilities_status_index` (`status`),
  KEY `professional_availabilities_professional_id_index` (`professional_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `professional_documents` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `professional_id` BIGINT NOT NULL,
  `document_type` VARCHAR(255) NOT NULL,
  `document_number_encrypted` TEXT NULL,
  `file_path` VARCHAR(255) NULL,
  `verification_status` VARCHAR(255) NOT NULL DEFAULT 'pending',
  `verified_by` BIGINT NULL,
  `verified_at` VARCHAR(255) NULL,
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `professional_documents_verification_status_index` (`verification_status`),
  KEY `professional_documents_professional_id_index` (`professional_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `professional_earnings` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `professional_id` BIGINT NOT NULL,
  `booking_id` BIGINT NULL,
  `earning_type` VARCHAR(255) NOT NULL DEFAULT 'service_fee',
  `amount` DECIMAL(12,2) NOT NULL,
  `status` VARCHAR(255) NOT NULL DEFAULT 'pending',
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `professional_earnings_status_index` (`status`),
  KEY `professional_earnings_booking_id_index` (`booking_id`),
  KEY `professional_earnings_professional_id_index` (`professional_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `professional_locations` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `professional_id` BIGINT NOT NULL,
  `lat` DECIMAL(10,7) NOT NULL,
  `lng` DECIMAL(10,7) NOT NULL,
  `accuracy` DECIMAL(12,2) NULL,
  `captured_at` VARCHAR(255) NOT NULL,
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `professional_locations_captured_at_index` (`captured_at`),
  KEY `professional_locations_professional_id_index` (`professional_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `professional_shifts` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `professional_id` BIGINT NOT NULL,
  `hub_id` BIGINT NULL,
  `starts_at` VARCHAR(255) NOT NULL,
  `ends_at` VARCHAR(255) NOT NULL,
  `status` VARCHAR(255) NOT NULL DEFAULT 'scheduled',
  `check_in_lat` DECIMAL(10,7) NULL,
  `check_in_lng` DECIMAL(10,7) NULL,
  `check_out_lat` DECIMAL(10,7) NULL,
  `check_out_lng` DECIMAL(10,7) NULL,
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `professional_shifts_status_index` (`status`),
  KEY `professional_shifts_hub_id_index` (`hub_id`),
  KEY `professional_shifts_professional_id_index` (`professional_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `professional_skills` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `professional_id` BIGINT NOT NULL,
  `skill_id` BIGINT NOT NULL,
  `level` VARCHAR(255) NOT NULL DEFAULT 'trained',
  `certified_at` VARCHAR(255) NULL,
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `professional_skills_skill_id_index` (`skill_id`),
  KEY `professional_skills_professional_id_index` (`professional_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `professionals` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `user_id` BIGINT NULL,
  `pro_code` VARCHAR(255) NOT NULL,
  `city_id` BIGINT NULL,
  `hub_id` BIGINT NULL,
  `onboarding_status` VARCHAR(255) NOT NULL DEFAULT 'lead',
  `employment_type` VARCHAR(255) NOT NULL DEFAULT 'partner',
  `rating_avg` DECIMAL(6,2) NOT NULL DEFAULT '0',
  `completed_jobs_count` BIGINT NOT NULL DEFAULT '0',
  `status` VARCHAR(255) NOT NULL DEFAULT 'lead',
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  `vendor_business_name` VARCHAR(255) NULL,
  `online_status` VARCHAR(255) NOT NULL DEFAULT 'offline',
  `wallet_balance` DECIMAL(12,2) NOT NULL DEFAULT '0',
  `plan_name` VARCHAR(255) NULL,
  `services_done_count` BIGINT NOT NULL DEFAULT '0',
  `bank_name` VARCHAR(255) NULL,
  `bank_account_number` VARCHAR(255) NULL,
  `bank_ifsc` VARCHAR(255) NULL,
  `full_address` TEXT NULL,
  `document_status` VARCHAR(255) NOT NULL DEFAULT 'pending',
  PRIMARY KEY (`id`),
  KEY `professionals_online_status_index` (`online_status`),
  KEY `professionals_status_index` (`status`),
  KEY `professionals_onboarding_status_index` (`onboarding_status`),
  KEY `professionals_hub_id_index` (`hub_id`),
  KEY `professionals_city_id_index` (`city_id`),
  UNIQUE KEY `professionals_pro_code_unique` (`pro_code`),
  KEY `professionals_user_id_index` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `quotes` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `cart_id` BIGINT NOT NULL,
  `user_id` BIGINT NOT NULL,
  `quote_number` VARCHAR(255) NOT NULL,
  `price_book_id` BIGINT NULL,
  `pricing_snapshot_json` JSON NOT NULL,
  `subtotal` DECIMAL(12,2) NOT NULL DEFAULT '0',
  `fees_total` DECIMAL(12,2) NOT NULL DEFAULT '0',
  `discount_total` DECIMAL(12,2) NOT NULL DEFAULT '0',
  `wallet_applied` DECIMAL(12,2) NOT NULL DEFAULT '0',
  `tax_total` DECIMAL(12,2) NOT NULL DEFAULT '0',
  `payable_total` DECIMAL(12,2) NOT NULL DEFAULT '0',
  `expires_at` VARCHAR(255) NOT NULL,
  `status` VARCHAR(255) NOT NULL DEFAULT 'active',
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `quotes_status_index` (`status`),
  KEY `quotes_price_book_id_index` (`price_book_id`),
  UNIQUE KEY `quotes_quote_number_unique` (`quote_number`),
  KEY `quotes_user_id_index` (`user_id`),
  KEY `quotes_cart_id_index` (`cart_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `rapid_coin_transactions` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `user_id` BIGINT NULL,
  `transaction_type` VARCHAR(255) NOT NULL,
  `coins` BIGINT NOT NULL,
  `reference_type` VARCHAR(255) NULL,
  `reference_id` BIGINT NULL,
  `notes` TEXT NULL,
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `rapid_coin_transactions_user_id_index` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `recurring_plans` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `plan_number` VARCHAR(255) NOT NULL,
  `user_id` BIGINT NOT NULL,
  `address_id` BIGINT NOT NULL,
  `quote_id` BIGINT NULL,
  `cadence` VARCHAR(255) NOT NULL DEFAULT 'weekly',
  `days_of_week_json` JSON NULL,
  `start_date` DATE NOT NULL,
  `end_date` DATE NULL,
  `preferred_start_time` TIME NULL,
  `status` VARCHAR(255) NOT NULL DEFAULT 'active',
  `paused_at` VARCHAR(255) NULL,
  `cancelled_at` VARCHAR(255) NULL,
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `recurring_plans_status_index` (`status`),
  KEY `recurring_plans_quote_id_index` (`quote_id`),
  KEY `recurring_plans_address_id_index` (`address_id`),
  KEY `recurring_plans_user_id_index` (`user_id`),
  UNIQUE KEY `recurring_plans_plan_number_unique` (`plan_number`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `recurring_sessions` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `recurring_plan_id` BIGINT NOT NULL,
  `booking_id` BIGINT NULL,
  `session_date` DATE NOT NULL,
  `scheduled_start_at` VARCHAR(255) NULL,
  `scheduled_end_at` VARCHAR(255) NULL,
  `status` VARCHAR(255) NOT NULL DEFAULT 'planned',
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `recurring_sessions_status_index` (`status`),
  KEY `recurring_sessions_session_date_index` (`session_date`),
  KEY `recurring_sessions_booking_id_index` (`booking_id`),
  KEY `recurring_sessions_recurring_plan_id_index` (`recurring_plan_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `referral_codes` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `owner_type` VARCHAR(255) NOT NULL,
  `owner_id` BIGINT NULL,
  `code` VARCHAR(255) NOT NULL,
  `status` VARCHAR(255) NOT NULL DEFAULT 'active',
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `referral_codes_status_index` (`status`),
  UNIQUE KEY `referral_codes_code_unique` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `referral_leads` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `referral_code_id` BIGINT NOT NULL,
  `referred_phone` VARCHAR(255) NOT NULL,
  `professional_application_id` BIGINT NULL,
  `status` VARCHAR(255) NOT NULL DEFAULT 'lead_created',
  `expires_at` VARCHAR(255) NULL,
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `referral_leads_status_index` (`status`),
  KEY `referral_leads_professional_application_id_index` (`professional_application_id`),
  KEY `referral_leads_referred_phone_index` (`referred_phone`),
  KEY `referral_leads_referral_code_id_index` (`referral_code_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `referral_rewards` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `referral_lead_id` BIGINT NOT NULL,
  `buddy_id` BIGINT NOT NULL,
  `amount` DECIMAL(12,2) NOT NULL DEFAULT '3000',
  `status` VARCHAR(255) NOT NULL DEFAULT 'pending',
  `eligible_at` VARCHAR(255) NULL,
  `paid_at` VARCHAR(255) NULL,
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `referral_rewards_status_index` (`status`),
  KEY `referral_rewards_buddy_id_index` (`buddy_id`),
  KEY `referral_rewards_referral_lead_id_index` (`referral_lead_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `refunds` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `booking_id` BIGINT NOT NULL,
  `payment_id` BIGINT NULL,
  `refund_number` VARCHAR(255) NOT NULL,
  `amount` DECIMAL(12,2) NOT NULL,
  `reason` VARCHAR(255) NULL,
  `status` VARCHAR(255) NOT NULL DEFAULT 'requested',
  `gateway_refund_id` VARCHAR(255) NULL,
  `approved_by` BIGINT NULL,
  `processed_at` VARCHAR(255) NULL,
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `refunds_gateway_refund_id_index` (`gateway_refund_id`),
  KEY `refunds_status_index` (`status`),
  UNIQUE KEY `refunds_refund_number_unique` (`refund_number`),
  KEY `refunds_payment_id_index` (`payment_id`),
  KEY `refunds_booking_id_index` (`booking_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `reviews` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `booking_id` BIGINT NOT NULL,
  `user_id` BIGINT NOT NULL,
  `professional_id` BIGINT NULL,
  `rating` BIGINT NOT NULL,
  `review_text` TEXT NULL,
  `status` VARCHAR(255) NOT NULL DEFAULT 'visible',
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `reviews_status_index` (`status`),
  KEY `reviews_professional_id_index` (`professional_id`),
  KEY `reviews_user_id_index` (`user_id`),
  KEY `reviews_booking_id_index` (`booking_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `service_addons` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `service_id` BIGINT NOT NULL,
  `name` VARCHAR(255) NOT NULL,
  `duration_minutes` BIGINT NOT NULL DEFAULT '15',
  `status` VARCHAR(255) NOT NULL DEFAULT 'active',
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `service_addons_status_index` (`status`),
  KEY `service_addons_service_id_index` (`service_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `service_areas` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `city_id` BIGINT NOT NULL,
  `locality_id` BIGINT NULL,
  `hub_id` BIGINT NULL,
  `name` VARCHAR(255) NOT NULL,
  `polygon_json` JSON NULL,
  `is_instant_enabled` TINYINT(1) NOT NULL DEFAULT '1',
  `is_scheduled_enabled` TINYINT(1) NOT NULL DEFAULT '1',
  `is_recurring_enabled` TINYINT(1) NOT NULL DEFAULT '1',
  `status` VARCHAR(255) NOT NULL DEFAULT 'active',
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `service_areas_status_index` (`status`),
  KEY `service_areas_hub_id_index` (`hub_id`),
  KEY `service_areas_locality_id_index` (`locality_id`),
  KEY `service_areas_city_id_index` (`city_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `service_availability` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `service_id` BIGINT NOT NULL,
  `city_id` BIGINT NOT NULL,
  `locality_id` BIGINT NULL,
  `is_instant_enabled` TINYINT(1) NOT NULL DEFAULT '1',
  `is_scheduled_enabled` TINYINT(1) NOT NULL DEFAULT '1',
  `is_recurring_enabled` TINYINT(1) NOT NULL DEFAULT '1',
  `status` VARCHAR(255) NOT NULL DEFAULT 'active',
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `service_availability_status_index` (`status`),
  KEY `service_availability_locality_id_index` (`locality_id`),
  KEY `service_availability_city_id_index` (`city_id`),
  KEY `service_availability_service_id_index` (`service_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `service_categories` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `name` VARCHAR(255) NOT NULL,
  `slug` VARCHAR(255) NOT NULL,
  `description` TEXT NULL,
  `icon_path` VARCHAR(255) NULL,
  `sort_order` BIGINT NOT NULL DEFAULT '0',
  `status` VARCHAR(255) NOT NULL DEFAULT 'active',
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `service_categories_status_index` (`status`),
  UNIQUE KEY `service_categories_slug_unique` (`slug`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `service_checklist_items` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `service_id` BIGINT NOT NULL,
  `title` VARCHAR(255) NOT NULL,
  `type` VARCHAR(255) NOT NULL DEFAULT 'completion_required',
  `is_required` TINYINT(1) NOT NULL DEFAULT '1',
  `sort_order` BIGINT NOT NULL DEFAULT '0',
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `service_checklist_items_service_id_index` (`service_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `service_packages` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `name` VARCHAR(255) NOT NULL,
  `description` TEXT NULL,
  `mrp_price` DECIMAL(12,2) NOT NULL DEFAULT '0',
  `sale_price` DECIMAL(12,2) NOT NULL DEFAULT '0',
  `validity_days` BIGINT NOT NULL DEFAULT '30',
  `service_ids_json` JSON NULL,
  `status` VARCHAR(255) NOT NULL DEFAULT 'active',
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `service_packages_status_index` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `service_prices` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `price_book_id` BIGINT NOT NULL,
  `service_id` BIGINT NOT NULL,
  `variant_id` BIGINT NULL,
  `base_price` DECIMAL(12,2) NOT NULL,
  `currency` VARCHAR(255) NOT NULL DEFAULT 'INR',
  `duration_minutes` BIGINT NOT NULL DEFAULT '60',
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `service_prices_variant_id_index` (`variant_id`),
  KEY `service_prices_service_id_index` (`service_id`),
  KEY `service_prices_price_book_id_index` (`price_book_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `service_skill_requirements` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `service_id` BIGINT NOT NULL,
  `skill_id` BIGINT NOT NULL,
  `required_level` VARCHAR(255) NOT NULL DEFAULT 'trained',
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `service_skill_requirements_skill_id_index` (`skill_id`),
  KEY `service_skill_requirements_service_id_index` (`service_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `service_variants` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `service_id` BIGINT NOT NULL,
  `name` VARCHAR(255) NOT NULL,
  `description` TEXT NULL,
  `duration_minutes` BIGINT NOT NULL DEFAULT '60',
  `base_unit` VARCHAR(255) NOT NULL DEFAULT 'visit',
  `status` VARCHAR(255) NOT NULL DEFAULT 'active',
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `service_variants_status_index` (`status`),
  KEY `service_variants_service_id_index` (`service_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `services` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `category_id` BIGINT NOT NULL,
  `name` VARCHAR(255) NOT NULL,
  `slug` VARCHAR(255) NOT NULL,
  `description` TEXT NULL,
  `service_type` VARCHAR(255) NOT NULL DEFAULT 'task',
  `default_duration_minutes` BIGINT NOT NULL DEFAULT '60',
  `min_duration_minutes` BIGINT NULL,
  `max_duration_minutes` BIGINT NULL,
  `is_stackable` TINYINT(1) NOT NULL DEFAULT '1',
  `requires_photos` TINYINT(1) NOT NULL DEFAULT '0',
  `status` VARCHAR(255) NOT NULL DEFAULT 'active',
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  `content_html` TEXT NULL,
  `icon_path` VARCHAR(255) NULL,
  `image_slider_json` JSON NULL,
  `mrp_price` DECIMAL(12,2) NULL,
  `sale_price` DECIMAL(12,2) NULL,
  `hourly_rate` DECIMAL(12,2) NULL,
  `is_hourly_enabled` TINYINT(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `services_status_index` (`status`),
  KEY `services_service_type_index` (`service_type`),
  UNIQUE KEY `services_slug_unique` (`slug`),
  KEY `services_category_id_index` (`category_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `skills` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `name` VARCHAR(255) NOT NULL,
  `slug` VARCHAR(255) NOT NULL,
  `status` VARCHAR(255) NOT NULL DEFAULT 'active',
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `skills_status_index` (`status`),
  UNIQUE KEY `skills_slug_unique` (`slug`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `sos_alerts` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `sos_number` VARCHAR(255) NOT NULL,
  `user_id` BIGINT NULL,
  `professional_id` BIGINT NULL,
  `booking_id` BIGINT NULL,
  `lat` DECIMAL(10,7) NULL,
  `lng` DECIMAL(10,7) NULL,
  `alert_type` VARCHAR(255) NOT NULL DEFAULT 'emergency',
  `message` TEXT NULL,
  `status` VARCHAR(255) NOT NULL DEFAULT 'open',
  `resolved_at` VARCHAR(255) NULL,
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `sos_alerts_status_index` (`status`),
  KEY `sos_alerts_booking_id_index` (`booking_id`),
  KEY `sos_alerts_professional_id_index` (`professional_id`),
  KEY `sos_alerts_user_id_index` (`user_id`),
  UNIQUE KEY `sos_alerts_sos_number_unique` (`sos_number`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `staff_profiles` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `user_id` BIGINT NOT NULL,
  `admin_role_id` BIGINT NULL,
  `employee_code` VARCHAR(255) NOT NULL,
  `department` VARCHAR(255) NULL,
  `designation` VARCHAR(255) NULL,
  `status` VARCHAR(255) NOT NULL DEFAULT 'active',
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `staff_profiles_status_index` (`status`),
  UNIQUE KEY `staff_profiles_employee_code_unique` (`employee_code`),
  KEY `staff_profiles_admin_role_id_index` (`admin_role_id`),
  KEY `staff_profiles_user_id_index` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `support_messages` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `support_ticket_id` BIGINT NOT NULL,
  `sender_type` VARCHAR(255) NOT NULL,
  `sender_id` BIGINT NULL,
  `message` TEXT NOT NULL,
  `attachment_path` VARCHAR(255) NULL,
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `support_messages_support_ticket_id_index` (`support_ticket_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `support_tickets` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `ticket_number` VARCHAR(255) NOT NULL,
  `user_id` BIGINT NULL,
  `booking_id` BIGINT NULL,
  `category` VARCHAR(255) NOT NULL DEFAULT 'general',
  `priority` VARCHAR(255) NOT NULL DEFAULT 'normal',
  `status` VARCHAR(255) NOT NULL DEFAULT 'open',
  `assigned_to` BIGINT NULL,
  `first_response_due_at` VARCHAR(255) NULL,
  `resolution_due_at` VARCHAR(255) NULL,
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `support_tickets_assigned_to_index` (`assigned_to`),
  KEY `support_tickets_status_index` (`status`),
  KEY `support_tickets_priority_index` (`priority`),
  KEY `support_tickets_booking_id_index` (`booking_id`),
  KEY `support_tickets_user_id_index` (`user_id`),
  UNIQUE KEY `support_tickets_ticket_number_unique` (`ticket_number`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `tax_rules` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `name` VARCHAR(255) NOT NULL,
  `tax_type` VARCHAR(255) NOT NULL DEFAULT 'gst',
  `percent` DECIMAL(6,2) NOT NULL DEFAULT '0',
  `hsn_sac` VARCHAR(255) NULL,
  `status` VARCHAR(255) NOT NULL DEFAULT 'active',
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `tax_rules_status_index` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `user_consents` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `user_id` BIGINT NOT NULL,
  `consent_type` VARCHAR(255) NOT NULL,
  `version` VARCHAR(255) NOT NULL,
  `accepted_at` VARCHAR(255) NOT NULL,
  `ip_address` VARCHAR(255) NULL,
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `user_consents_user_id_index` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `user_devices` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `user_id` BIGINT NOT NULL,
  `device_type` VARCHAR(255) NOT NULL DEFAULT 'android',
  `device_token` VARCHAR(255) NULL,
  `app_version` VARCHAR(255) NULL,
  `os_version` VARCHAR(255) NULL,
  `last_seen_at` VARCHAR(255) NULL,
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `user_devices_user_id_index` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `users` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `uuid` VARCHAR(255) NOT NULL,
  `name` VARCHAR(255) NULL,
  `email` VARCHAR(255) NULL,
  `phone_country_code` VARCHAR(255) NOT NULL DEFAULT '+91',
  `phone` VARCHAR(255) NOT NULL,
  `avatar_path` VARCHAR(255) NULL,
  `gender` VARCHAR(255) NULL,
  `date_of_birth` DATE NULL,
  `role` VARCHAR(255) NOT NULL DEFAULT 'customer',
  `status` VARCHAR(255) NOT NULL DEFAULT 'active',
  `last_login_at` VARCHAR(255) NULL,
  `email_verified_at` VARCHAR(255) NULL,
  `password` VARCHAR(255) NULL,
  `remember_token` VARCHAR(255) NULL,
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `users_status_index` (`status`),
  KEY `users_role_index` (`role`),
  UNIQUE KEY `users_phone_unique` (`phone`),
  UNIQUE KEY `users_email_unique` (`email`),
  UNIQUE KEY `users_uuid_unique` (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `wallet_accounts` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `user_id` BIGINT NOT NULL,
  `balance` DECIMAL(12,2) NOT NULL DEFAULT '0',
  `currency` VARCHAR(255) NOT NULL DEFAULT 'INR',
  `status` VARCHAR(255) NOT NULL DEFAULT 'active',
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `wallet_accounts_status_index` (`status`),
  UNIQUE KEY `wallet_accounts_user_id_unique` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `wallet_transactions` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `wallet_account_id` BIGINT NOT NULL,
  `transaction_type` VARCHAR(255) NOT NULL,
  `amount` DECIMAL(12,2) NOT NULL,
  `balance_after` DECIMAL(12,2) NOT NULL,
  `reference_type` VARCHAR(255) NULL,
  `reference_id` BIGINT NULL,
  `expires_at` VARCHAR(255) NULL,
  `created_at` VARCHAR(255) NULL,
  `updated_at` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  KEY `wallet_transactions_wallet_account_id_index` (`wallet_account_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

SET FOREIGN_KEY_CHECKS=1;
