-- https://www.phpmyadmin.net/
--
-- Servidor: localhost
-- Tiempo de generación: 11-05-2026 a las 15:35:37
-- Versión del servidor: 10.4.28-MariaDB
-- Versión de PHP: 8.2.4

START TRANSACTION;



--
-- Base de datos: `reservapro`
--

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `activity_log`
--

CREATE TABLE `activity_log` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `log_name` varchar(255) DEFAULT NULL,
  `description` text NOT NULL,
  `subject_type` varchar(255) DEFAULT NULL,
  `event` varchar(255) DEFAULT NULL,
  `subject_id` bigint(20) UNSIGNED DEFAULT NULL,
  `causer_type` varchar(255) DEFAULT NULL,
  `causer_id` bigint(20) UNSIGNED DEFAULT NULL,
  `properties` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`properties`)),
  `batch_uuid` char(36) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `app_notifications`
--

CREATE TABLE `app_notifications` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `company_id` bigint(20) UNSIGNED DEFAULT NULL,
  `user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `type` varchar(50) NOT NULL,
  `title` varchar(255) NOT NULL,
  `message` text DEFAULT NULL,
  `icon` varchar(50) DEFAULT NULL,
  `color` varchar(20) DEFAULT NULL,
  `action_url` varchar(255) DEFAULT NULL,
  `data` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`data`)),
  `read_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Volcado de datos para la tabla `app_notifications`
--

INSERT INTO `app_notifications` (`id`, `company_id`, `user_id`, `type`, `title`, `message`, `icon`, `color`, `action_url`, `data`, `read_at`, `created_at`) VALUES
(1, 1, 2, 'booking.created', 'Nueva reserva', 'Daniel Amaya reservó Barba para el 04/05 14:45', 'calendar', 'indigo', '/empresa/bookings/e538eb02-eb1b-4b87-b225-5413b812e40f', '{\"booking_id\":7,\"code\":\"BK-202605-000002\"}', '2026-05-04 01:44:26', '2026-05-03 17:46:39'),
(2, 1, 2, 'booking.created', 'Nueva reserva', 'Carlos Amaya reservó Corte clásico para el 05/05 09:00', 'calendar', 'indigo', '/empresa/bookings/0b23ed9e-9ba3-4ee5-ac84-4f662bede249', '{\"booking_id\":8,\"code\":\"BK-202605-000003\"}', '2026-05-04 01:44:23', '2026-05-03 18:10:43'),
(3, 1, 2, 'booking.created', 'Nueva reserva', 'Daniel Amaya reservó Corte + barba para el 09/05 10:45', 'calendar', 'indigo', '/empresa/bookings/39333639-d7c9-498e-817d-c6d42f8dd231', '{\"booking_id\":10,\"code\":\"BK-202605-000004\"}', '2026-05-08 03:00:04', '2026-05-08 02:55:13'),
(4, 1, 2, 'booking.created', 'Nueva reserva', 'Daniel Amaya reservó Barba para el 08/05 12:30', 'calendar', 'indigo', '/empresa/bookings/9aabc81a-1aa6-491b-ac5e-f1c214940133', '{\"booking_id\":11,\"code\":\"BK-202605-000005\"}', '2026-05-09 21:37:52', '2026-05-08 15:57:00'),
(5, 1, 2, 'booking.created', 'Nueva reserva', 'Daniel Amaya reservó Corte + barba para el 13/05 11:45', 'calendar', 'indigo', '/empresa/bookings/653ce908-09bd-4078-819f-5313d5373e3f', '{\"booking_id\":12,\"code\":\"BK-202605-000006\"}', '2026-05-09 21:37:55', '2026-05-08 16:05:33'),
(6, 1, 2, 'booking.created', 'Nueva reserva', 'Daniel Amaya reservó Corte + barba para el 08/05 16:45', 'calendar', 'indigo', '/empresa/bookings/11bc0665-14af-4792-9cd8-5ca9da25637f', '{\"booking_id\":13,\"code\":\"BK-202605-000007\"}', '2026-05-09 21:37:49', '2026-05-08 16:29:19'),
(7, 1, 2, 'booking.created', 'Nueva reserva', 'Daniel Amaya reservó Barba para el 08/05 13:00', 'calendar', 'indigo', '/empresa/bookings/a43f3159-9dfa-46a1-a736-ed0690d15389', '{\"booking_id\":14,\"code\":\"BK-202605-000008\"}', '2026-05-09 21:37:45', '2026-05-08 16:46:57'),
(8, 1, 2, 'booking.created', 'Nueva reserva', 'Daniel Amaya reservó Corte + barba para el 08/05 15:15', 'calendar', 'indigo', '/empresa/bookings/8a7c6472-8121-48f4-ae38-91b0418c0087', '{\"booking_id\":15,\"code\":\"BK-202605-000009\"}', '2026-05-09 21:37:42', '2026-05-08 16:56:00'),
(9, 1, 2, 'booking.created', 'Nueva reserva', 'Daniel Amaya reservó Corte + barba para el 08/05 13:45', 'calendar', 'indigo', '/empresa/bookings/27c54c4d-3b9b-4df1-b38b-2b3f9346a67d', '{\"booking_id\":16,\"code\":\"BK-202605-000010\"}', '2026-05-09 21:37:39', '2026-05-08 17:01:45'),
(10, 1, 2, 'booking.cancelled', 'Reserva cancelada', 'Daniel Amaya canceló Corte + barba del 09/05 13:45', 'calendar', 'rose', '/empresa/bookings/27c54c4d-3b9b-4df1-b38b-2b3f9346a67d', '{\"booking_id\":16,\"code\":\"BK-202605-000010\"}', '2026-05-09 21:37:36', '2026-05-08 17:26:16');

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `bookings`
--

CREATE TABLE `bookings` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `uuid` char(36) NOT NULL,
  `code` varchar(20) NOT NULL,
  `company_id` bigint(20) UNSIGNED NOT NULL,
  `branch_id` bigint(20) UNSIGNED DEFAULT NULL,
  `customer_id` bigint(20) UNSIGNED NOT NULL,
  `service_id` bigint(20) UNSIGNED NOT NULL,
  `employee_id` bigint(20) UNSIGNED DEFAULT NULL,
  `status` enum('pending','confirmed','cancelled','completed','no_show','rescheduled','archived') NOT NULL DEFAULT 'pending',
  `source` enum('public','admin','employee','api') NOT NULL DEFAULT 'public',
  `booking_date` date NOT NULL,
  `start_time` time NOT NULL,
  `end_time` time NOT NULL,
  `scheduled_at` datetime NOT NULL,
  `duration_minutes` int(10) UNSIGNED NOT NULL,
  `service_price` decimal(12,2) NOT NULL DEFAULT 0.00,
  `discount_amount` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_amount` decimal(12,2) NOT NULL DEFAULT 0.00,
  `paid_amount` decimal(12,2) NOT NULL DEFAULT 0.00,
  `currency` varchar(3) NOT NULL DEFAULT 'COP',
  `coupon_id` bigint(20) UNSIGNED DEFAULT NULL,
  `promotion_id` bigint(20) UNSIGNED DEFAULT NULL,
  `customer_notes` text DEFAULT NULL,
  `internal_notes` text DEFAULT NULL,
  `cancellation_reason` varchar(255) DEFAULT NULL,
  `cancelled_at` timestamp NULL DEFAULT NULL,
  `cancelled_by` bigint(20) UNSIGNED DEFAULT NULL,
  `reminder_sent_at` timestamp NULL DEFAULT NULL,
  `confirmed_at` timestamp NULL DEFAULT NULL,
  `completed_at` timestamp NULL DEFAULT NULL,
  `rescheduled_from_id` bigint(20) UNSIGNED DEFAULT NULL,
  `rescheduled_to_id` bigint(20) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Volcado de datos para la tabla `bookings`
--

INSERT INTO `bookings` (`id`, `uuid`, `code`, `company_id`, `branch_id`, `customer_id`, `service_id`, `employee_id`, `status`, `source`, `booking_date`, `start_time`, `end_time`, `scheduled_at`, `duration_minutes`, `service_price`, `discount_amount`, `total_amount`, `paid_amount`, `currency`, `coupon_id`, `promotion_id`, `customer_notes`, `internal_notes`, `cancellation_reason`, `cancelled_at`, `cancelled_by`, `reminder_sent_at`, `confirmed_at`, `completed_at`, `rescheduled_from_id`, `rescheduled_to_id`, `created_at`, `updated_at`, `deleted_at`) VALUES
(4, 'a2e2f60a-e256-4cc5-9f25-9c1025ea251a', 'BK-202604-000001', 1, 1, 6, 2, 2, 'archived', 'public', '2026-05-04', '10:45:00', '11:30:00', '2026-05-04 10:45:00', 45, 35000.00, 0.00, 35000.00, 0.00, 'COP', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2026-04-29 00:53:30', '2026-05-08 02:33:33', NULL),
(5, '0cb09f77-9781-4141-93a8-e55a729bedfb', 'BK-202604-000002', 1, 1, 7, 2, 1, 'archived', 'public', '2026-05-01', '11:00:00', '11:45:00', '2026-05-01 11:00:00', 45, 35000.00, 0.00, 35000.00, 0.00, 'COP', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2026-04-29 02:29:07', '2026-05-08 02:35:58', NULL),
(6, '65375d66-35e7-4ade-bef7-9ba69b59f4bc', 'BK-202605-000001', 1, 1, 8, 4, 3, 'archived', 'public', '2026-05-04', '09:30:00', '10:30:00', '2026-05-04 09:30:00', 60, 60000.00, 0.00, 60000.00, 0.00, 'COP', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2026-05-02 15:27:54', '2026-05-08 02:33:33', NULL),
(7, 'e538eb02-eb1b-4b87-b225-5413b812e40f', 'BK-202605-000002', 1, 1, 9, 3, 2, 'archived', 'public', '2026-05-04', '14:45:00', '15:05:00', '2026-05-04 14:45:00', 20, 15000.00, 0.00, 15000.00, 0.00, 'COP', NULL, NULL, 'Hola', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2026-05-03 17:46:34', '2026-05-08 02:33:33', NULL),
(8, '0b23ed9e-9ba3-4ee5-ac84-4f662bede249', 'BK-202605-000003', 1, 1, 10, 1, 1, 'archived', 'public', '2026-05-05', '09:00:00', '09:30:00', '2026-05-05 09:00:00', 30, 25000.00, 0.00, 25000.00, 0.00, 'COP', NULL, NULL, 'El mismo corte de siempre, lo mas rápido posible', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2026-05-03 18:10:38', '2026-05-08 02:33:33', NULL),
(10, '39333639-d7c9-498e-817d-c6d42f8dd231', 'BK-202605-000004', 1, 1, 9, 2, 2, 'archived', 'public', '2026-05-08', '08:45:00', '09:30:00', '2026-05-08 08:45:00', 45, 35000.00, 0.00, 35000.00, 0.00, 'COP', NULL, NULL, 'Hola', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2026-05-08 02:55:10', '2026-05-08 15:25:38', NULL),
(11, '9aabc81a-1aa6-491b-ac5e-f1c214940133', 'BK-202605-000005', 1, 1, 9, 3, 2, 'completed', 'public', '2026-05-08', '12:30:00', '12:50:00', '2026-05-08 12:30:00', 20, 15000.00, 1500.00, 13500.00, 0.00, 'COP', NULL, 1, 'Hola', NULL, NULL, NULL, NULL, NULL, '2026-05-08 16:02:17', '2026-05-08 16:02:30', NULL, NULL, '2026-05-08 15:56:54', '2026-05-08 16:02:30', NULL),
(12, '653ce908-09bd-4078-819f-5313d5373e3f', 'BK-202605-000006', 1, 1, 9, 2, 2, 'completed', 'public', '2026-05-13', '11:45:00', '12:30:00', '2026-05-13 11:45:00', 45, 35000.00, 3500.00, 31500.00, 0.00, 'COP', NULL, 1, 'Que mas', NULL, NULL, NULL, NULL, NULL, '2026-05-08 16:15:30', '2026-05-08 16:15:37', NULL, NULL, '2026-05-08 16:05:27', '2026-05-08 16:15:37', NULL),
(13, '11bc0665-14af-4792-9cd8-5ca9da25637f', 'BK-202605-000007', 1, 1, 9, 2, 1, 'completed', 'public', '2026-05-08', '16:45:00', '17:30:00', '2026-05-08 16:45:00', 45, 35000.00, 3500.00, 31500.00, 0.00, 'COP', NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, '2026-05-08 16:29:34', '2026-05-08 16:30:45', NULL, NULL, '2026-05-08 16:29:14', '2026-05-08 16:30:45', NULL),
(14, 'a43f3159-9dfa-46a1-a736-ed0690d15389', 'BK-202605-000008', 1, 1, 9, 3, 2, 'no_show', 'public', '2026-05-08', '13:00:00', '13:20:00', '2026-05-08 13:00:00', 20, 15000.00, 1500.00, 13500.00, 0.00, 'COP', NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2026-05-08 16:46:53', '2026-05-09 21:38:10', NULL),
(15, '8a7c6472-8121-48f4-ae38-91b0418c0087', 'BK-202605-000009', 1, 1, 9, 2, 2, 'no_show', 'public', '2026-05-10', '15:15:00', '16:00:00', '2026-05-10 15:15:00', 45, 35000.00, 3500.00, 31500.00, 0.00, 'COP', NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, '2026-05-08 16:56:08', NULL, NULL, NULL, '2026-05-08 16:55:57', '2026-05-11 12:34:01', NULL),
(16, '27c54c4d-3b9b-4df1-b38b-2b3f9346a67d', 'BK-202605-000010', 1, 1, 6, 2, 2, 'cancelled', 'admin', '2026-05-09', '13:45:00', '14:30:00', '2026-05-09 13:45:00', 45, 35000.00, 0.00, 35000.00, 0.00, 'COP', NULL, NULL, NULL, NULL, 'No puede asisstir.', '2026-05-08 17:26:12', 2, NULL, NULL, NULL, NULL, NULL, '2026-05-08 17:01:41', '2026-05-08 17:26:12', NULL);

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `booking_status_history`
--

CREATE TABLE `booking_status_history` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `company_id` bigint(20) UNSIGNED NOT NULL,
  `booking_id` bigint(20) UNSIGNED NOT NULL,
  `from_status` varchar(30) DEFAULT NULL,
  `to_status` varchar(30) NOT NULL,
  `changed_by` bigint(20) UNSIGNED DEFAULT NULL,
  `changed_by_role` varchar(50) DEFAULT NULL,
  `reason` text DEFAULT NULL,
  `metadata` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`metadata`)),
  `created_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Volcado de datos para la tabla `booking_status_history`
--

INSERT INTO `booking_status_history` (`id`, `company_id`, `booking_id`, `from_status`, `to_status`, `changed_by`, `changed_by_role`, `reason`, `metadata`, `created_at`) VALUES
(8, 1, 4, NULL, 'pending', NULL, NULL, 'Reserva creada', NULL, '2026-04-29 00:53:30'),
(9, 1, 5, NULL, 'pending', 2, 'company_admin', 'Reserva creada', NULL, '2026-04-29 02:29:07'),
(10, 1, 6, NULL, 'pending', 2, 'company_admin', 'Reserva creada', NULL, '2026-05-02 15:27:54'),
(11, 1, 5, 'pending', 'no_show', NULL, NULL, NULL, NULL, '2026-05-02 21:32:18'),
(12, 1, 7, NULL, 'pending', 2, 'company_admin', 'Reserva creada', NULL, '2026-05-03 17:46:34'),
(13, 1, 8, NULL, 'pending', 2, 'company_admin', 'Reserva creada', NULL, '2026-05-03 18:10:38'),
(15, 1, 10, NULL, 'pending', 2, 'company_admin', 'Reserva creada', NULL, '2026-05-08 02:55:10'),
(16, 1, 11, NULL, 'pending', 2, 'company_admin', 'Reserva creada', NULL, '2026-05-08 15:56:54'),
(17, 1, 11, 'pending', 'confirmed', 2, 'company_admin', NULL, NULL, '2026-05-08 16:02:17'),
(18, 1, 11, 'confirmed', 'completed', 2, 'company_admin', NULL, NULL, '2026-05-08 16:02:30'),
(19, 1, 12, NULL, 'pending', 2, 'company_admin', 'Reserva creada', NULL, '2026-05-08 16:05:27'),
(20, 1, 12, 'pending', 'confirmed', 2, 'company_admin', NULL, NULL, '2026-05-08 16:15:30'),
(21, 1, 12, 'confirmed', 'completed', 2, 'company_admin', NULL, NULL, '2026-05-08 16:15:37'),
(22, 1, 13, NULL, 'pending', 2, 'company_admin', 'Reserva creada', NULL, '2026-05-08 16:29:14'),
(23, 1, 13, 'pending', 'confirmed', 2, 'company_admin', NULL, NULL, '2026-05-08 16:29:34'),
(24, 1, 13, 'confirmed', 'completed', 2, 'company_admin', NULL, NULL, '2026-05-08 16:30:45'),
(25, 1, 14, NULL, 'pending', 2, 'company_admin', 'Reserva creada', NULL, '2026-05-08 16:46:53'),
(26, 1, 15, NULL, 'pending', 2, 'company_admin', 'Reserva creada', NULL, '2026-05-08 16:55:57'),
(27, 1, 15, 'pending', 'confirmed', 2, 'company_admin', NULL, NULL, '2026-05-08 16:56:08'),
(28, 1, 16, NULL, 'confirmed', 2, 'company_admin', 'Reserva creada', NULL, '2026-05-08 17:01:41'),
(29, 1, 16, 'confirmed', 'cancelled', 2, 'company_admin', NULL, NULL, '2026-05-08 17:26:12'),
(30, 1, 14, 'pending', 'no_show', 2, 'company_admin', NULL, NULL, '2026-05-09 21:38:10'),
(31, 1, 15, 'confirmed', 'no_show', 2, 'company_admin', NULL, NULL, '2026-05-11 12:34:01');

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `branches`
--

CREATE TABLE `branches` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `company_id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `slug` varchar(255) DEFAULT NULL,
  `phone` varchar(25) DEFAULT NULL,
  `whatsapp` varchar(25) DEFAULT NULL,
  `email` varchar(255) DEFAULT NULL,
  `address` varchar(255) DEFAULT NULL,
  `city` varchar(100) DEFAULT NULL,
  `state` varchar(100) DEFAULT NULL,
  `country` varchar(100) NOT NULL DEFAULT 'Colombia',
  `latitude` decimal(10,7) DEFAULT NULL,
  `longitude` decimal(10,7) DEFAULT NULL,
  `timezone` varchar(50) DEFAULT NULL,
  `is_main` tinyint(1) NOT NULL DEFAULT 0,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Volcado de datos para la tabla `branches`
--

INSERT INTO `branches` (`id`, `company_id`, `name`, `slug`, `phone`, `whatsapp`, `email`, `address`, `city`, `state`, `country`, `latitude`, `longitude`, `timezone`, `is_main`, `is_active`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 1, 'Sede Principal', 'principal', '+573001234567', NULL, 'demo@reservapro.test', 'Calle 100 # 15-20', 'Bogotá', 'Cundinamarca', 'Colombia', NULL, NULL, 'America/Bogota', 1, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24', NULL);

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `cash_movements`
--

CREATE TABLE `cash_movements` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `uuid` char(36) NOT NULL,
  `company_id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `booking_id` bigint(20) UNSIGNED DEFAULT NULL,
  `type` enum('income','expense') NOT NULL,
  `payment_method` enum('cash','card','transfer','online','other') NOT NULL DEFAULT 'cash',
  `status` enum('confirmed','void') NOT NULL DEFAULT 'confirmed',
  `category` varchar(80) NOT NULL DEFAULT 'General',
  `reference` varchar(80) DEFAULT NULL,
  `description` varchar(255) NOT NULL,
  `amount` decimal(12,2) NOT NULL,
  `currency` varchar(3) NOT NULL DEFAULT 'COP',
  `occurred_at` datetime NOT NULL,
  `notes` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Volcado de datos para la tabla `cash_movements`
--

INSERT INTO `cash_movements` (`id`, `uuid`, `company_id`, `user_id`, `booking_id`, `type`, `payment_method`, `status`, `category`, `reference`, `description`, `amount`, `currency`, `occurred_at`, `notes`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 'e5aac62a-819f-4517-9767-dbf961e1c283', 1, 2, 12, 'income', 'cash', 'confirmed', 'Servicios', 'BK-202605-000006', 'Cita atendida: Corte + barba', 31500.00, 'COP', '2026-05-08 11:15:37', 'Ingreso automático por reserva BK-202605-000006 - Daniel Amaya', '2026-05-08 16:15:37', '2026-05-08 16:15:37', NULL),
(2, 'c6ab24bf-97b6-4270-b94d-c0c03c122c69', 1, 2, 13, 'income', 'card', 'confirmed', 'Servicios', 'BK-202605-000007', 'Cita atendida: Corte + barba', 31500.00, 'COP', '2026-05-08 11:30:45', 'Ingreso automático por reserva BK-202605-000007 - Daniel Amaya', '2026-05-08 16:30:45', '2026-05-08 16:30:45', NULL);

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `client_conditions`
--

CREATE TABLE `client_conditions` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `company_id` bigint(20) UNSIGNED NOT NULL,
  `clinical_history_id` bigint(20) UNSIGNED NOT NULL,
  `type` enum('allergy','disease','medication','contraindication','sensitivity','other') NOT NULL,
  `name` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `severity` enum('low','medium','high','critical') NOT NULL DEFAULT 'low',
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `detected_at` date DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `client_files`
--

CREATE TABLE `client_files` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `uuid` char(36) NOT NULL,
  `company_id` bigint(20) UNSIGNED NOT NULL,
  `clinical_history_id` bigint(20) UNSIGNED NOT NULL,
  `booking_id` bigint(20) UNSIGNED DEFAULT NULL,
  `uploaded_by` bigint(20) UNSIGNED DEFAULT NULL,
  `type` enum('photo','document','prescription','authorization','evidence','other') NOT NULL DEFAULT 'other',
  `title` varchar(255) DEFAULT NULL,
  `description` text DEFAULT NULL,
  `path` varchar(255) NOT NULL,
  `original_name` varchar(255) NOT NULL,
  `mime_type` varchar(100) NOT NULL,
  `size_bytes` bigint(20) UNSIGNED NOT NULL DEFAULT 0,
  `is_private` tinyint(1) NOT NULL DEFAULT 1,
  `tags` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`tags`)),
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `clinical_backgrounds`
--

CREATE TABLE `clinical_backgrounds` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `company_id` bigint(20) UNSIGNED NOT NULL,
  `clinical_history_id` bigint(20) UNSIGNED NOT NULL,
  `customer_id` bigint(20) UNSIGNED NOT NULL,
  `type` enum('personal','family','surgical','traumatic','allergic','pharmacological','gynecological','habits','other') NOT NULL,
  `title` varchar(255) DEFAULT NULL,
  `description` text NOT NULL,
  `recorded_at` date DEFAULT NULL,
  `created_by` bigint(20) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `clinical_diagnoses`
--

CREATE TABLE `clinical_diagnoses` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `company_id` bigint(20) UNSIGNED NOT NULL,
  `clinical_history_id` bigint(20) UNSIGNED NOT NULL,
  `clinical_evolution_id` bigint(20) UNSIGNED DEFAULT NULL,
  `customer_id` bigint(20) UNSIGNED NOT NULL,
  `cie10_code` varchar(20) DEFAULT NULL,
  `name` varchar(255) NOT NULL,
  `type` enum('primary','secondary','impression') NOT NULL DEFAULT 'primary',
  `notes` text DEFAULT NULL,
  `created_by` bigint(20) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `clinical_evolutions`
--

CREATE TABLE `clinical_evolutions` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `uuid` char(36) NOT NULL,
  `company_id` bigint(20) UNSIGNED NOT NULL,
  `clinical_history_id` bigint(20) UNSIGNED NOT NULL,
  `customer_id` bigint(20) UNSIGNED NOT NULL,
  `booking_id` bigint(20) UNSIGNED DEFAULT NULL,
  `employee_id` bigint(20) UNSIGNED DEFAULT NULL,
  `consultation_reason` text NOT NULL,
  `current_illness` text DEFAULT NULL,
  `physical_exam` text DEFAULT NULL,
  `vital_signs` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`vital_signs`)),
  `diagnosis_notes` text DEFAULT NULL,
  `treatment_plan` text DEFAULT NULL,
  `recommendations` text DEFAULT NULL,
  `next_control_date` date DEFAULT NULL,
  `status` enum('draft','signed','cancelled') NOT NULL DEFAULT 'draft',
  `signed_at` timestamp NULL DEFAULT NULL,
  `signed_by` bigint(20) UNSIGNED DEFAULT NULL,
  `created_by` bigint(20) UNSIGNED DEFAULT NULL,
  `updated_by` bigint(20) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `clinical_histories`
--

CREATE TABLE `clinical_histories` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `uuid` char(36) NOT NULL,
  `company_id` bigint(20) UNSIGNED NOT NULL,
  `customer_id` bigint(20) UNSIGNED NOT NULL,
  `history_number` varchar(50) DEFAULT NULL,
  `opening_date` date DEFAULT NULL,
  `status` enum('active','closed','archived') NOT NULL DEFAULT 'active',
  `allergies` text DEFAULT NULL,
  `diseases` text DEFAULT NULL,
  `current_medications` text DEFAULT NULL,
  `previous_procedures` text DEFAULT NULL,
  `contraindications` text DEFAULT NULL,
  `skin_sensitivity` text DEFAULT NULL,
  `special_conditions` text DEFAULT NULL,
  `medical_notes` text DEFAULT NULL,
  `skin_type` varchar(50) DEFAULT NULL,
  `hair_type` varchar(50) DEFAULT NULL,
  `current_color` varchar(100) DEFAULT NULL,
  `formulas_used` text DEFAULT NULL,
  `treatments_done` text DEFAULT NULL,
  `initial_diagnosis` text DEFAULT NULL,
  `treatment_evolution` text DEFAULT NULL,
  `internal_notes` text DEFAULT NULL,
  `created_by` bigint(20) UNSIGNED DEFAULT NULL,
  `updated_by` bigint(20) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Volcado de datos para la tabla `clinical_histories`
--

INSERT INTO `clinical_histories` (`id`, `uuid`, `company_id`, `customer_id`, `history_number`, `opening_date`, `status`, `allergies`, `diseases`, `current_medications`, `previous_procedures`, `contraindications`, `skin_sensitivity`, `special_conditions`, `medical_notes`, `skin_type`, `hair_type`, `current_color`, `formulas_used`, `treatments_done`, `initial_diagnosis`, `treatment_evolution`, `internal_notes`, `created_by`, `updated_by`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 'ce0f76cf-9572-4cfe-ab85-8822493f80b9', 1, 6, NULL, NULL, 'active', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 2, NULL, '2026-04-29 01:07:50', '2026-04-29 01:07:50', NULL);

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `clinical_notes`
--

CREATE TABLE `clinical_notes` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `company_id` bigint(20) UNSIGNED NOT NULL,
  `clinical_history_id` bigint(20) UNSIGNED NOT NULL,
  `booking_id` bigint(20) UNSIGNED DEFAULT NULL,
  `employee_id` bigint(20) UNSIGNED DEFAULT NULL,
  `created_by` bigint(20) UNSIGNED DEFAULT NULL,
  `title` varchar(255) DEFAULT NULL,
  `content` text NOT NULL,
  `tags` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`tags`)),
  `is_private` tinyint(1) NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `clinical_orders`
--

CREATE TABLE `clinical_orders` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `uuid` char(36) NOT NULL,
  `company_id` bigint(20) UNSIGNED NOT NULL,
  `clinical_history_id` bigint(20) UNSIGNED NOT NULL,
  `clinical_evolution_id` bigint(20) UNSIGNED DEFAULT NULL,
  `customer_id` bigint(20) UNSIGNED NOT NULL,
  `employee_id` bigint(20) UNSIGNED DEFAULT NULL,
  `type` enum('laboratory','imaging','procedure','referral','care_recommendation','aesthetic_plan','therapy_plan','other') NOT NULL,
  `title` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `notes` text DEFAULT NULL,
  `status` enum('draft','signed','fulfilled','cancelled') NOT NULL DEFAULT 'draft',
  `signed_at` timestamp NULL DEFAULT NULL,
  `signed_by` bigint(20) UNSIGNED DEFAULT NULL,
  `created_by` bigint(20) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `companies`
--

CREATE TABLE `companies` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `uuid` char(36) NOT NULL,
  `name` varchar(255) NOT NULL,
  `slug` varchar(255) NOT NULL,
  `legal_name` varchar(255) DEFAULT NULL,
  `document_type` varchar(20) DEFAULT NULL,
  `document_number` varchar(50) DEFAULT NULL,
  `email` varchar(255) NOT NULL,
  `phone` varchar(25) DEFAULT NULL,
  `whatsapp` varchar(25) DEFAULT NULL,
  `website` varchar(255) DEFAULT NULL,
  `address` varchar(255) DEFAULT NULL,
  `city` varchar(100) DEFAULT NULL,
  `state` varchar(100) DEFAULT NULL,
  `country` varchar(100) NOT NULL DEFAULT 'Colombia',
  `postal_code` varchar(20) DEFAULT NULL,
  `latitude` decimal(10,7) DEFAULT NULL,
  `longitude` decimal(10,7) DEFAULT NULL,
  `logo_path` varchar(255) DEFAULT NULL,
  `cover_path` varchar(255) DEFAULT NULL,
  `primary_color` varchar(7) NOT NULL DEFAULT '#4f46e5',
  `secondary_color` varchar(7) NOT NULL DEFAULT '#06b6d4',
  `description` text DEFAULT NULL,
  `social_links` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`social_links`)),
  `timezone` varchar(50) NOT NULL DEFAULT 'America/Bogota',
  `locale` varchar(10) NOT NULL DEFAULT 'es',
  `currency` varchar(3) NOT NULL DEFAULT 'COP',
  `booking_buffer_minutes` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `booking_min_advance_minutes` int(10) UNSIGNED NOT NULL DEFAULT 30,
  `booking_max_advance_days` int(10) UNSIGNED NOT NULL DEFAULT 60,
  `allow_guest_booking` tinyint(1) NOT NULL DEFAULT 1,
  `allow_customer_cancel` tinyint(1) NOT NULL DEFAULT 1,
  `allow_customer_reschedule` tinyint(1) NOT NULL DEFAULT 1,
  `cancellation_hours_limit` int(10) UNSIGNED NOT NULL DEFAULT 2,
  `status` enum('trial','active','suspended','cancelled') NOT NULL DEFAULT 'trial',
  `plan_id` bigint(20) UNSIGNED DEFAULT NULL,
  `trial_ends_at` timestamp NULL DEFAULT NULL,
  `subscription_starts_at` timestamp NULL DEFAULT NULL,
  `subscription_ends_at` timestamp NULL DEFAULT NULL,
  `suspended_at` timestamp NULL DEFAULT NULL,
  `suspension_reason` varchar(255) DEFAULT NULL,
  `settings` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`settings`)),
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Volcado de datos para la tabla `companies`
--

INSERT INTO `companies` (`id`, `uuid`, `name`, `slug`, `legal_name`, `document_type`, `document_number`, `email`, `phone`, `whatsapp`, `website`, `address`, `city`, `state`, `country`, `postal_code`, `latitude`, `longitude`, `logo_path`, `cover_path`, `primary_color`, `secondary_color`, `description`, `social_links`, `timezone`, `locale`, `currency`, `booking_buffer_minutes`, `booking_min_advance_minutes`, `booking_max_advance_days`, `allow_guest_booking`, `allow_customer_cancel`, `allow_customer_reschedule`, `cancellation_hours_limit`, `status`, `plan_id`, `trial_ends_at`, `subscription_starts_at`, `subscription_ends_at`, `suspended_at`, `suspension_reason`, `settings`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, '1aebd7e3-3e91-452e-b9a8-5bbb32768cac', 'Barbería Demo', 'barberia-demo', 'Barbería Demo S.A.S.', 'NIT', '900.123.456-7', 'demo@reservapro.test', '+573001234567', '+573001234567', NULL, 'Calle 100 # 15-20', 'Bogotá', 'Cundinamarca', 'Colombia', NULL, NULL, NULL, 'branding/Mw6liw2bFIbE2IgWoFyssPFa1FS5n8u2RPPkI6BP.png', 'branding/es1Xg5AFlAxXDfQ5ajgagdbGBOqXfN7BdOUgDmH5.jpg', '#0f172a', '#06b6d4', 'Barbería de demostración para ReservaPro.', NULL, 'America/Bogota', 'es', 'COP', 0, 30, 60, 1, 1, 1, 2, 'active', 2, '2026-05-12 19:22:24', '2026-04-28 19:22:24', '2026-05-28 19:22:24', NULL, NULL, NULL, '2026-04-28 19:22:24', '2026-05-08 16:33:15', NULL);

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `company_modules`
--

CREATE TABLE `company_modules` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `company_id` bigint(20) UNSIGNED NOT NULL,
  `module_id` bigint(20) UNSIGNED NOT NULL,
  `is_enabled` tinyint(1) NOT NULL DEFAULT 1,
  `notes` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Volcado de datos para la tabla `company_modules`
--

INSERT INTO `company_modules` (`id`, `company_id`, `module_id`, `is_enabled`, `notes`, `created_at`, `updated_at`) VALUES
(1, 1, 22, 0, NULL, '2026-05-04 00:09:09', '2026-05-04 01:09:22'),
(2, 1, 20, 0, NULL, '2026-05-04 00:09:09', '2026-05-04 01:09:22'),
(3, 1, 21, 0, NULL, '2026-05-04 00:09:09', '2026-05-04 01:09:22'),
(4, 1, 23, 1, 'Habilitado para pruebas del módulo Caja', '2026-05-08 02:20:02', '2026-05-08 02:20:02');

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `consent_forms`
--

CREATE TABLE `consent_forms` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `company_id` bigint(20) UNSIGNED NOT NULL,
  `clinical_history_id` bigint(20) UNSIGNED NOT NULL,
  `booking_id` bigint(20) UNSIGNED DEFAULT NULL,
  `employee_id` bigint(20) UNSIGNED DEFAULT NULL,
  `title` varchar(255) NOT NULL,
  `content` longtext NOT NULL,
  `document_path` varchar(255) DEFAULT NULL,
  `signature_path` varchar(255) DEFAULT NULL,
  `signer_name` varchar(255) DEFAULT NULL,
  `signer_document` varchar(50) DEFAULT NULL,
  `signed_ip` varchar(45) DEFAULT NULL,
  `signed_user_agent` varchar(255) DEFAULT NULL,
  `signed_at` timestamp NULL DEFAULT NULL,
  `status` enum('pending','signed','rejected','expired') NOT NULL DEFAULT 'pending',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `consent_templates`
--

CREATE TABLE `consent_templates` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `company_id` bigint(20) UNSIGNED NOT NULL,
  `title` varchar(255) NOT NULL,
  `content` longtext NOT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `requires_signature` tinyint(1) NOT NULL DEFAULT 1,
  `created_by` bigint(20) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Volcado de datos para la tabla `consent_templates`
--

INSERT INTO `consent_templates` (`id`, `company_id`, `title`, `content`, `is_active`, `requires_signature`, `created_by`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 1, 'Hola', 'Hola', 1, 1, 2, '2026-05-03 22:38:56', '2026-05-03 22:38:56', NULL);

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `coupons`
--

CREATE TABLE `coupons` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `company_id` bigint(20) UNSIGNED DEFAULT NULL,
  `code` varchar(50) NOT NULL,
  `scope` enum('saas','company') NOT NULL DEFAULT 'company',
  `discount_type` enum('percentage','fixed') NOT NULL DEFAULT 'percentage',
  `discount_value` decimal(12,2) NOT NULL,
  `min_amount` decimal(12,2) DEFAULT NULL,
  `max_discount` decimal(12,2) DEFAULT NULL,
  `starts_at` timestamp NULL DEFAULT NULL,
  `ends_at` timestamp NULL DEFAULT NULL,
  `usage_limit` int(10) UNSIGNED DEFAULT NULL,
  `usage_limit_per_customer` int(10) UNSIGNED DEFAULT NULL,
  `used_count` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `customers`
--

CREATE TABLE `customers` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `uuid` char(36) NOT NULL,
  `company_id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `first_name` varchar(255) NOT NULL,
  `second_name` varchar(255) DEFAULT NULL,
  `last_name` varchar(255) DEFAULT NULL,
  `second_lastname` varchar(255) DEFAULT NULL,
  `email` varchar(255) DEFAULT NULL,
  `phone` varchar(25) NOT NULL,
  `document_type` varchar(20) DEFAULT NULL,
  `document_number` varchar(50) DEFAULT NULL,
  `birthdate` date DEFAULT NULL,
  `gender` enum('male','female','other') DEFAULT NULL,
  `address` varchar(255) DEFAULT NULL,
  `city` varchar(100) DEFAULT NULL,
  `country` varchar(100) DEFAULT NULL,
  `blood_type` varchar(10) DEFAULT NULL,
  `insurance_company` varchar(150) DEFAULT NULL,
  `emergency_contact_name` varchar(255) DEFAULT NULL,
  `emergency_contact_phone` varchar(25) DEFAULT NULL,
  `notes` text DEFAULT NULL,
  `is_frequent` tinyint(1) NOT NULL DEFAULT 0,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `marketing_opt_in` tinyint(1) NOT NULL DEFAULT 1,
  `first_booking_at` timestamp NULL DEFAULT NULL,
  `last_booking_at` timestamp NULL DEFAULT NULL,
  `total_bookings` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `total_spent` decimal(12,2) NOT NULL DEFAULT 0.00,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Volcado de datos para la tabla `customers`
--

INSERT INTO `customers` (`id`, `uuid`, `company_id`, `user_id`, `first_name`, `second_name`, `last_name`, `second_lastname`, `email`, `phone`, `document_type`, `document_number`, `birthdate`, `gender`, `address`, `city`, `country`, `blood_type`, `insurance_company`, `emergency_contact_name`, `emergency_contact_phone`, `notes`, `is_frequent`, `is_active`, `marketing_opt_in`, `first_booking_at`, `last_booking_at`, `total_bookings`, `total_spent`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 'b82c703c-c3cb-40cf-91ae-ba48eef1d49c', 1, NULL, 'Andrea', NULL, 'López', NULL, 'andrea@example.com', '+573101111111', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 1, 1, NULL, NULL, 0, 0.00, '2026-04-28 19:22:24', '2026-04-28 19:22:24', NULL),
(2, '2f67f49a-f853-4f18-b8a8-41efa02c8545', 1, NULL, 'Felipe', NULL, 'Martínez', NULL, 'felipe@example.com', '+573102222222', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 1, 1, NULL, NULL, 0, 0.00, '2026-04-28 19:22:24', '2026-04-28 19:22:24', NULL),
(3, 'a04b4ea5-612a-40c0-99ca-1033fd0528e8', 1, NULL, 'Camila', NULL, 'Hernández', NULL, 'camila@example.com', '+573103333333', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 1, 1, NULL, NULL, 0, 0.00, '2026-04-28 19:22:24', '2026-04-28 19:22:24', NULL),
(6, '90de9c9b-333c-48b9-9880-e1ec1dbe7e04', 1, NULL, 'Daniel', NULL, 'Amaya', NULL, 'danielamaya774@gmail.com', '3122644576', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 1, 1, NULL, NULL, 0, 0.00, '2026-04-29 00:53:30', '2026-04-29 00:53:30', NULL),
(7, 'df831f86-c053-42fa-b720-7d169939810a', 1, NULL, 'Luis', NULL, 'Concha', NULL, 'daniamaya774@gmail.com', '3246802685', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 1, 1, NULL, NULL, 0, 0.00, '2026-04-29 02:29:07', '2026-04-29 02:29:07', NULL),
(8, '789cd7be-5fbe-4bd5-a152-40d35d68f2e0', 1, NULL, 'luisa', NULL, 'concha', NULL, 'luisaconcha93@gmail.com', '324680268', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 1, 1, NULL, NULL, 0, 0.00, '2026-05-02 15:27:54', '2026-05-02 15:27:54', NULL),
(9, 'fe4a594b-e164-4c3f-bda2-227f645752f1', 1, NULL, 'Daniel', NULL, 'Amaya', NULL, 'danielamaya774@gmail.com', '+573122644576', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 1, 1, '2026-05-08 16:02:30', '2026-05-08 16:30:45', 3, 76500.00, '2026-05-03 17:46:34', '2026-05-08 16:30:45', NULL),
(10, 'a1bc0d6a-a482-42e4-a38f-0841117d38b3', 1, NULL, 'Carlos', NULL, 'Amaya', NULL, 'carlosconchaescobar@gmail.com', '+573164805911', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 1, 1, NULL, NULL, 0, 0.00, '2026-05-03 18:10:38', '2026-05-03 18:10:38', NULL);

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `employees`
--

CREATE TABLE `employees` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `company_id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `branch_id` bigint(20) UNSIGNED DEFAULT NULL,
  `first_name` varchar(255) NOT NULL,
  `last_name` varchar(255) DEFAULT NULL,
  `email` varchar(255) DEFAULT NULL,
  `phone` varchar(25) DEFAULT NULL,
  `document_number` varchar(50) DEFAULT NULL,
  `position` varchar(255) DEFAULT NULL,
  `photo_path` varchar(255) DEFAULT NULL,
  `bio` text DEFAULT NULL,
  `color` varchar(7) NOT NULL DEFAULT '#4f46e5',
  `has_commission` tinyint(1) NOT NULL DEFAULT 0,
  `commission_type` enum('percentage','fixed') DEFAULT NULL,
  `commission_value` decimal(10,2) DEFAULT NULL,
  `is_bookable` tinyint(1) NOT NULL DEFAULT 1,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `sort_order` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Volcado de datos para la tabla `employees`
--

INSERT INTO `employees` (`id`, `company_id`, `user_id`, `branch_id`, `first_name`, `last_name`, `email`, `phone`, `document_number`, `position`, `photo_path`, `bio`, `color`, `has_commission`, `commission_type`, `commission_value`, `is_bookable`, `is_active`, `sort_order`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 1, NULL, 1, 'Juana', 'Concha', NULL, NULL, NULL, 'Barbero senior', 'employees/JH90F6YXDGQQnHD8geuVTQtc4rbPDdhaEn9isGtD.jpg', NULL, '#4f46e5', 0, NULL, NULL, 1, 1, 0, '2026-04-28 19:22:24', '2026-05-04 01:24:12', NULL),
(2, 1, NULL, 1, 'Carlos', 'Gómez', 'danielamaya774@gmail.com', NULL, NULL, 'Barbero', 'employees/cQ9rWmQlkWGEt93n7bALaaTXgBJ1bKdmbarGOhVl.jpg', NULL, '#000000', 0, NULL, NULL, 1, 1, 0, '2026-04-28 19:22:24', '2026-05-04 01:17:25', NULL),
(3, 1, NULL, 1, 'María', 'Rodríguez', NULL, NULL, NULL, 'Estilista', NULL, NULL, '#f59e0b', 0, NULL, NULL, 1, 1, 0, '2026-04-28 19:22:24', '2026-04-28 19:22:24', NULL);

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `employee_services`
--

CREATE TABLE `employee_services` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `company_id` bigint(20) UNSIGNED NOT NULL,
  `employee_id` bigint(20) UNSIGNED NOT NULL,
  `service_id` bigint(20) UNSIGNED NOT NULL,
  `custom_price` decimal(12,2) DEFAULT NULL,
  `custom_duration_minutes` int(10) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Volcado de datos para la tabla `employee_services`
--

INSERT INTO `employee_services` (`id`, `company_id`, `employee_id`, `service_id`, `custom_price`, `custom_duration_minutes`, `created_at`, `updated_at`) VALUES
(1, 1, 1, 1, NULL, NULL, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(2, 1, 1, 2, NULL, NULL, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(3, 1, 1, 3, NULL, NULL, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(4, 1, 1, 4, NULL, NULL, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(5, 1, 2, 1, NULL, NULL, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(6, 1, 2, 2, NULL, NULL, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(7, 1, 2, 3, NULL, NULL, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(9, 1, 3, 1, NULL, NULL, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(10, 1, 3, 2, NULL, NULL, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(11, 1, 3, 3, NULL, NULL, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(12, 1, 3, 4, NULL, NULL, '2026-04-28 19:22:24', '2026-04-28 19:22:24');

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `failed_jobs`
--

CREATE TABLE `failed_jobs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `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()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `gallery_items`
--

CREATE TABLE `gallery_items` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `company_id` bigint(20) UNSIGNED NOT NULL,
  `title` varchar(255) DEFAULT NULL,
  `description` text DEFAULT NULL,
  `image_path` varchar(255) NOT NULL,
  `sort_order` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `is_public` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Volcado de datos para la tabla `gallery_items`
--

INSERT INTO `gallery_items` (`id`, `company_id`, `title`, `description`, `image_path`, `sort_order`, `is_public`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 1, 'Barberia', NULL, 'gallery/C7hhXxkAzvpnqkcxrH8dQADvAbVUbGG4IbwsTJ6o.webp', 0, 1, '2026-05-04 01:18:57', '2026-05-04 01:18:57', NULL),
(2, 1, 'Corte', NULL, 'gallery/slNwU2xcfOW24TUWAb2P8XGp8gXRKy2yTyccLJiZ.jpg', 0, 1, '2026-05-04 01:20:12', '2026-05-08 03:12:41', '2026-05-08 03:12:41');

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `jobs`
--

CREATE TABLE `jobs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `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
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Volcado de datos para la tabla `jobs`
--

INSERT INTO `jobs` (`id`, `queue`, `payload`, `attempts`, `reserved_at`, `available_at`, `created_at`) VALUES
(1, 'default', '{\"uuid\":\"ba7cf6d3-914e-44c8-aebd-786e57e45f0d\",\"displayName\":\"App\\\\Listeners\\\\SendBookingConfirmation\",\"job\":\"Illuminate\\\\Queue\\\\CallQueuedHandler@call\",\"maxTries\":null,\"maxExceptions\":null,\"failOnTimeout\":false,\"backoff\":null,\"timeout\":null,\"retryUntil\":null,\"data\":{\"commandName\":\"Illuminate\\\\Events\\\\CallQueuedListener\",\"command\":\"O:36:\\\"Illuminate\\\\Events\\\\CallQueuedListener\\\":20:{s:5:\\\"class\\\";s:37:\\\"App\\\\Listeners\\\\SendBookingConfirmation\\\";s:6:\\\"method\\\";s:6:\\\"handle\\\";s:4:\\\"data\\\";a:1:{i:0;O:25:\\\"App\\\\Events\\\\BookingCreated\\\":1:{s:7:\\\"booking\\\";O:45:\\\"Illuminate\\\\Contracts\\\\Database\\\\ModelIdentifier\\\":5:{s:5:\\\"class\\\";s:18:\\\"App\\\\Models\\\\Booking\\\";s:2:\\\"id\\\";i:1;s:9:\\\"relations\\\";a:0:{}s:10:\\\"connection\\\";s:5:\\\"mysql\\\";s:15:\\\"collectionClass\\\";N;}}}s:5:\\\"tries\\\";N;s:13:\\\"maxExceptions\\\";N;s:7:\\\"backoff\\\";N;s:10:\\\"retryUntil\\\";N;s:7:\\\"timeout\\\";N;s:13:\\\"failOnTimeout\\\";b:0;s:17:\\\"shouldBeEncrypted\\\";b:0;s:3:\\\"job\\\";N;s:10:\\\"connection\\\";N;s:5:\\\"queue\\\";N;s:5:\\\"delay\\\";N;s:11:\\\"afterCommit\\\";N;s:10:\\\"middleware\\\";a:0:{}s:7:\\\"chained\\\";a:0:{}s:15:\\\"chainConnection\\\";N;s:10:\\\"chainQueue\\\";N;s:19:\\\"chainCatchCallbacks\\\";N;}\"}}', 0, NULL, 1777422028, 1777422028),
(2, 'default', '{\"uuid\":\"d840ff25-f6a0-499d-bfb1-d84b0f751fb7\",\"displayName\":\"App\\\\Listeners\\\\SendBookingConfirmation\",\"job\":\"Illuminate\\\\Queue\\\\CallQueuedHandler@call\",\"maxTries\":null,\"maxExceptions\":null,\"failOnTimeout\":false,\"backoff\":null,\"timeout\":null,\"retryUntil\":null,\"data\":{\"commandName\":\"Illuminate\\\\Events\\\\CallQueuedListener\",\"command\":\"O:36:\\\"Illuminate\\\\Events\\\\CallQueuedListener\\\":20:{s:5:\\\"class\\\";s:37:\\\"App\\\\Listeners\\\\SendBookingConfirmation\\\";s:6:\\\"method\\\";s:6:\\\"handle\\\";s:4:\\\"data\\\";a:1:{i:0;O:25:\\\"App\\\\Events\\\\BookingCreated\\\":1:{s:7:\\\"booking\\\";O:45:\\\"Illuminate\\\\Contracts\\\\Database\\\\ModelIdentifier\\\":5:{s:5:\\\"class\\\";s:18:\\\"App\\\\Models\\\\Booking\\\";s:2:\\\"id\\\";i:2;s:9:\\\"relations\\\";a:0:{}s:10:\\\"connection\\\";s:5:\\\"mysql\\\";s:15:\\\"collectionClass\\\";N;}}}s:5:\\\"tries\\\";N;s:13:\\\"maxExceptions\\\";N;s:7:\\\"backoff\\\";N;s:10:\\\"retryUntil\\\";N;s:7:\\\"timeout\\\";N;s:13:\\\"failOnTimeout\\\";b:0;s:17:\\\"shouldBeEncrypted\\\";b:0;s:3:\\\"job\\\";N;s:10:\\\"connection\\\";N;s:5:\\\"queue\\\";N;s:5:\\\"delay\\\";N;s:11:\\\"afterCommit\\\";N;s:10:\\\"middleware\\\";a:0:{}s:7:\\\"chained\\\";a:0:{}s:15:\\\"chainConnection\\\";N;s:10:\\\"chainQueue\\\";N;s:19:\\\"chainCatchCallbacks\\\";N;}\"}}', 0, NULL, 1777422908, 1777422908),
(3, 'default', '{\"uuid\":\"23bb6483-ee12-4af3-a340-1eeaa8576ee7\",\"displayName\":\"App\\\\Listeners\\\\SendBookingConfirmation\",\"job\":\"Illuminate\\\\Queue\\\\CallQueuedHandler@call\",\"maxTries\":null,\"maxExceptions\":null,\"failOnTimeout\":false,\"backoff\":null,\"timeout\":null,\"retryUntil\":null,\"data\":{\"commandName\":\"Illuminate\\\\Events\\\\CallQueuedListener\",\"command\":\"O:36:\\\"Illuminate\\\\Events\\\\CallQueuedListener\\\":20:{s:5:\\\"class\\\";s:37:\\\"App\\\\Listeners\\\\SendBookingConfirmation\\\";s:6:\\\"method\\\";s:6:\\\"handle\\\";s:4:\\\"data\\\";a:1:{i:0;O:25:\\\"App\\\\Events\\\\BookingCreated\\\":1:{s:7:\\\"booking\\\";O:45:\\\"Illuminate\\\\Contracts\\\\Database\\\\ModelIdentifier\\\":5:{s:5:\\\"class\\\";s:18:\\\"App\\\\Models\\\\Booking\\\";s:2:\\\"id\\\";i:3;s:9:\\\"relations\\\";a:0:{}s:10:\\\"connection\\\";s:5:\\\"mysql\\\";s:15:\\\"collectionClass\\\";N;}}}s:5:\\\"tries\\\";N;s:13:\\\"maxExceptions\\\";N;s:7:\\\"backoff\\\";N;s:10:\\\"retryUntil\\\";N;s:7:\\\"timeout\\\";N;s:13:\\\"failOnTimeout\\\";b:0;s:17:\\\"shouldBeEncrypted\\\";b:0;s:3:\\\"job\\\";N;s:10:\\\"connection\\\";N;s:5:\\\"queue\\\";N;s:5:\\\"delay\\\";N;s:11:\\\"afterCommit\\\";N;s:10:\\\"middleware\\\";a:0:{}s:7:\\\"chained\\\";a:0:{}s:15:\\\"chainConnection\\\";N;s:10:\\\"chainQueue\\\";N;s:19:\\\"chainCatchCallbacks\\\";N;}\"}}', 0, NULL, 1777422936, 1777422936),
(4, 'default', '{\"uuid\":\"20d3944f-7f8f-4bb0-abf8-37545b2fab7b\",\"displayName\":\"App\\\\Listeners\\\\SendBookingConfirmation\",\"job\":\"Illuminate\\\\Queue\\\\CallQueuedHandler@call\",\"maxTries\":null,\"maxExceptions\":null,\"failOnTimeout\":false,\"backoff\":null,\"timeout\":null,\"retryUntil\":null,\"data\":{\"commandName\":\"Illuminate\\\\Events\\\\CallQueuedListener\",\"command\":\"O:36:\\\"Illuminate\\\\Events\\\\CallQueuedListener\\\":20:{s:5:\\\"class\\\";s:37:\\\"App\\\\Listeners\\\\SendBookingConfirmation\\\";s:6:\\\"method\\\";s:6:\\\"handle\\\";s:4:\\\"data\\\";a:1:{i:0;O:25:\\\"App\\\\Events\\\\BookingCreated\\\":1:{s:7:\\\"booking\\\";O:45:\\\"Illuminate\\\\Contracts\\\\Database\\\\ModelIdentifier\\\":5:{s:5:\\\"class\\\";s:18:\\\"App\\\\Models\\\\Booking\\\";s:2:\\\"id\\\";i:4;s:9:\\\"relations\\\";a:0:{}s:10:\\\"connection\\\";s:5:\\\"mysql\\\";s:15:\\\"collectionClass\\\";N;}}}s:5:\\\"tries\\\";N;s:13:\\\"maxExceptions\\\";N;s:7:\\\"backoff\\\";N;s:10:\\\"retryUntil\\\";N;s:7:\\\"timeout\\\";N;s:13:\\\"failOnTimeout\\\";b:0;s:17:\\\"shouldBeEncrypted\\\";b:0;s:3:\\\"job\\\";N;s:10:\\\"connection\\\";N;s:5:\\\"queue\\\";N;s:5:\\\"delay\\\";N;s:11:\\\"afterCommit\\\";N;s:10:\\\"middleware\\\";a:0:{}s:7:\\\"chained\\\";a:0:{}s:15:\\\"chainConnection\\\";N;s:10:\\\"chainQueue\\\";N;s:19:\\\"chainCatchCallbacks\\\";N;}\"}}', 0, NULL, 1777424010, 1777424010),
(5, 'default', '{\"uuid\":\"ae01fa95-20b8-43ff-a476-101bc81aceb8\",\"displayName\":\"App\\\\Listeners\\\\SendBookingConfirmation\",\"job\":\"Illuminate\\\\Queue\\\\CallQueuedHandler@call\",\"maxTries\":null,\"maxExceptions\":null,\"failOnTimeout\":false,\"backoff\":null,\"timeout\":null,\"retryUntil\":null,\"data\":{\"commandName\":\"Illuminate\\\\Events\\\\CallQueuedListener\",\"command\":\"O:36:\\\"Illuminate\\\\Events\\\\CallQueuedListener\\\":20:{s:5:\\\"class\\\";s:37:\\\"App\\\\Listeners\\\\SendBookingConfirmation\\\";s:6:\\\"method\\\";s:6:\\\"handle\\\";s:4:\\\"data\\\";a:1:{i:0;O:25:\\\"App\\\\Events\\\\BookingCreated\\\":1:{s:7:\\\"booking\\\";O:45:\\\"Illuminate\\\\Contracts\\\\Database\\\\ModelIdentifier\\\":5:{s:5:\\\"class\\\";s:18:\\\"App\\\\Models\\\\Booking\\\";s:2:\\\"id\\\";i:5;s:9:\\\"relations\\\";a:0:{}s:10:\\\"connection\\\";s:5:\\\"mysql\\\";s:15:\\\"collectionClass\\\";N;}}}s:5:\\\"tries\\\";N;s:13:\\\"maxExceptions\\\";N;s:7:\\\"backoff\\\";N;s:10:\\\"retryUntil\\\";N;s:7:\\\"timeout\\\";N;s:13:\\\"failOnTimeout\\\";b:0;s:17:\\\"shouldBeEncrypted\\\";b:0;s:3:\\\"job\\\";N;s:10:\\\"connection\\\";N;s:5:\\\"queue\\\";N;s:5:\\\"delay\\\";N;s:11:\\\"afterCommit\\\";N;s:10:\\\"middleware\\\";a:0:{}s:7:\\\"chained\\\";a:0:{}s:15:\\\"chainConnection\\\";N;s:10:\\\"chainQueue\\\";N;s:19:\\\"chainCatchCallbacks\\\";N;}\"}}', 0, NULL, 1777429747, 1777429747),
(6, 'default', '{\"uuid\":\"29d16204-0588-4caa-8120-e0ad8fd46019\",\"displayName\":\"App\\\\Listeners\\\\SendBookingConfirmation\",\"job\":\"Illuminate\\\\Queue\\\\CallQueuedHandler@call\",\"maxTries\":null,\"maxExceptions\":null,\"failOnTimeout\":false,\"backoff\":null,\"timeout\":null,\"retryUntil\":null,\"data\":{\"commandName\":\"Illuminate\\\\Events\\\\CallQueuedListener\",\"command\":\"O:36:\\\"Illuminate\\\\Events\\\\CallQueuedListener\\\":20:{s:5:\\\"class\\\";s:37:\\\"App\\\\Listeners\\\\SendBookingConfirmation\\\";s:6:\\\"method\\\";s:6:\\\"handle\\\";s:4:\\\"data\\\";a:1:{i:0;O:25:\\\"App\\\\Events\\\\BookingCreated\\\":1:{s:7:\\\"booking\\\";O:45:\\\"Illuminate\\\\Contracts\\\\Database\\\\ModelIdentifier\\\":5:{s:5:\\\"class\\\";s:18:\\\"App\\\\Models\\\\Booking\\\";s:2:\\\"id\\\";i:6;s:9:\\\"relations\\\";a:0:{}s:10:\\\"connection\\\";s:5:\\\"mysql\\\";s:15:\\\"collectionClass\\\";N;}}}s:5:\\\"tries\\\";N;s:13:\\\"maxExceptions\\\";N;s:7:\\\"backoff\\\";N;s:10:\\\"retryUntil\\\";N;s:7:\\\"timeout\\\";N;s:13:\\\"failOnTimeout\\\";b:0;s:17:\\\"shouldBeEncrypted\\\";b:0;s:3:\\\"job\\\";N;s:10:\\\"connection\\\";N;s:5:\\\"queue\\\";N;s:5:\\\"delay\\\";N;s:11:\\\"afterCommit\\\";N;s:10:\\\"middleware\\\";a:0:{}s:7:\\\"chained\\\";a:0:{}s:15:\\\"chainConnection\\\";N;s:10:\\\"chainQueue\\\";N;s:19:\\\"chainCatchCallbacks\\\";N;}\"}}', 0, NULL, 1777735675, 1777735675);

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `job_batches`
--

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
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `migrations`
--

CREATE TABLE `migrations` (
  `id` int(10) UNSIGNED NOT NULL,
  `migration` varchar(255) NOT NULL,
  `batch` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Volcado de datos para la tabla `migrations`
--

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_04_28_140148_create_permission_tables', 1),
(5, '2026_04_28_140149_create_activity_log_table', 1),
(6, '2026_04_28_140150_add_event_column_to_activity_log_table', 1),
(7, '2026_04_28_140151_add_batch_uuid_column_to_activity_log_table', 1),
(8, '2026_04_28_141000_create_plans_table', 1),
(9, '2026_04_28_141001_create_modules_table', 1),
(10, '2026_04_28_141002_create_plan_modules_table', 1),
(11, '2026_04_28_141003_create_companies_table', 1),
(12, '2026_04_28_141004_create_branches_table', 1),
(13, '2026_04_28_141005_create_company_modules_table', 1),
(14, '2026_04_28_141006_create_subscriptions_table', 1),
(15, '2026_04_28_141007_create_subscription_payments_table', 1),
(16, '2026_04_28_141008_create_payment_methods_table', 1),
(17, '2026_04_28_141009_create_service_categories_table', 1),
(18, '2026_04_28_141010_create_services_table', 1),
(19, '2026_04_28_141011_create_employees_table', 1),
(20, '2026_04_28_141012_create_employee_services_table', 1),
(21, '2026_04_28_141013_create_schedules_table', 1),
(22, '2026_04_28_141014_create_schedule_blocks_table', 1),
(23, '2026_04_28_141015_create_customers_table', 1),
(24, '2026_04_28_141016_create_bookings_table', 1),
(25, '2026_04_28_141017_create_booking_status_history_table', 1),
(26, '2026_04_28_141018_create_promotions_table', 1),
(27, '2026_04_28_141019_create_coupons_table', 1),
(28, '2026_04_28_141020_create_app_notifications_table', 1),
(29, '2026_04_28_141021_create_settings_table', 1),
(30, '2026_04_28_141022_create_clinical_histories_table', 1),
(31, '2026_04_28_141023_create_clinical_notes_table', 1),
(32, '2026_04_28_141024_create_client_conditions_table', 1),
(33, '2026_04_28_141025_create_treatment_records_table', 1),
(34, '2026_04_28_141026_create_consent_forms_table', 1),
(35, '2026_04_28_141027_create_client_files_table', 1),
(36, '2026_04_30_180000_create_gallery_items_table', 2),
(37, '2026_05_02_170000_add_cancellation_notice_to_services_table', 3),
(38, '2026_05_03_100001_add_clinical_fields_to_customers_table', 4),
(39, '2026_05_03_100002_add_clinical_fields_to_clinical_histories_table', 5),
(40, '2026_05_03_100003_create_clinical_backgrounds_table', 6),
(41, '2026_05_03_100004_create_clinical_evolutions_table', 7),
(42, '2026_05_03_100005_create_clinical_diagnoses_table', 8),
(43, '2026_05_03_100006_create_prescriptions_table', 9),
(44, '2026_05_03_100007_create_prescription_items_table', 10),
(45, '2026_05_03_100008_create_clinical_orders_table', 11),
(46, '2026_05_03_100009_create_consent_templates_table', 12),
(47, '2026_05_07_210000_create_cash_movements_table', 13),
(48, '2026_05_07_213000_add_archived_status_to_bookings_table', 14),
(49, '2026_05_09_181536_create_push_subscriptions_table', 15);

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `model_has_permissions`
--

CREATE TABLE `model_has_permissions` (
  `permission_id` bigint(20) UNSIGNED NOT NULL,
  `model_type` varchar(255) NOT NULL,
  `model_id` bigint(20) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `model_has_roles`
--

CREATE TABLE `model_has_roles` (
  `role_id` bigint(20) UNSIGNED NOT NULL,
  `model_type` varchar(255) NOT NULL,
  `model_id` bigint(20) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Volcado de datos para la tabla `model_has_roles`
--

INSERT INTO `model_has_roles` (`role_id`, `model_type`, `model_id`) VALUES
(1, 'App\\Models\\User', 1),
(2, 'App\\Models\\User', 2);

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `permissions`
--

CREATE TABLE `permissions` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `guard_name` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Volcado de datos para la tabla `permissions`
--

INSERT INTO `permissions` (`id`, `name`, `guard_name`, `created_at`, `updated_at`) VALUES
(1, 'saas.manage', 'web', '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(2, 'companies.manage', 'web', '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(3, 'plans.manage', 'web', '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(4, 'subscriptions.manage', 'web', '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(5, 'modules.manage', 'web', '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(6, 'global_reports.view', 'web', '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(7, 'activity_logs.view', 'web', '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(8, 'company.manage', 'web', '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(9, 'company.settings', 'web', '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(10, 'employees.view', 'web', '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(11, 'employees.manage', 'web', '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(12, 'services.view', 'web', '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(13, 'services.manage', 'web', '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(14, 'schedules.manage', 'web', '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(15, 'customers.view', 'web', '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(16, 'customers.manage', 'web', '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(17, 'bookings.view', 'web', '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(18, 'bookings.create', 'web', '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(19, 'bookings.update', 'web', '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(20, 'bookings.cancel', 'web', '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(21, 'reports.view', 'web', '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(22, 'promotions.manage', 'web', '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(23, 'coupons.manage', 'web', '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(24, 'payments.view', 'web', '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(25, 'payments.manage', 'web', '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(26, 'gallery.manage', 'web', '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(27, 'clinical_history.view', 'web', '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(28, 'clinical_history.edit', 'web', '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(29, 'consent_forms.manage', 'web', '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(30, 'client_files.manage', 'web', '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(31, 'agenda.view', 'web', '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(32, 'bookings.update_own', 'web', '2026-04-28 19:22:24', '2026-04-28 19:22:24');

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `plans`
--

CREATE TABLE `plans` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `slug` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `price_monthly` decimal(12,2) NOT NULL DEFAULT 0.00,
  `price_yearly` decimal(12,2) NOT NULL DEFAULT 0.00,
  `currency` varchar(3) NOT NULL DEFAULT 'COP',
  `promo_price_monthly` decimal(12,2) DEFAULT NULL,
  `promo_price_yearly` decimal(12,2) DEFAULT NULL,
  `promo_starts_at` date DEFAULT NULL,
  `promo_ends_at` date DEFAULT NULL,
  `max_employees` int(10) UNSIGNED DEFAULT NULL,
  `max_services` int(10) UNSIGNED DEFAULT NULL,
  `max_bookings_month` int(10) UNSIGNED DEFAULT NULL,
  `max_branches` int(10) UNSIGNED DEFAULT 1,
  `max_customers` int(10) UNSIGNED DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `is_featured` tinyint(1) NOT NULL DEFAULT 0,
  `is_public` tinyint(1) NOT NULL DEFAULT 1,
  `trial_days` int(10) UNSIGNED NOT NULL DEFAULT 14,
  `sort_order` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Volcado de datos para la tabla `plans`
--

INSERT INTO `plans` (`id`, `name`, `slug`, `description`, `price_monthly`, `price_yearly`, `currency`, `promo_price_monthly`, `promo_price_yearly`, `promo_starts_at`, `promo_ends_at`, `max_employees`, `max_services`, `max_bookings_month`, `max_branches`, `max_customers`, `is_active`, `is_featured`, `is_public`, `trial_days`, `sort_order`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 'Básico', 'basic', 'Ideal para iniciar tu negocio.', 49000.00, 490000.00, 'COP', NULL, NULL, NULL, NULL, 3, 10, 200, 1, NULL, 1, 0, 1, 14, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24', NULL),
(2, 'Profesional', 'professional', 'Para negocios en crecimiento.', 99000.00, 990000.00, 'COP', NULL, NULL, NULL, NULL, 10, 50, 1000, 1, NULL, 1, 1, 1, 14, 2, '2026-04-28 19:22:24', '2026-04-28 19:22:24', NULL),
(3, 'Premium', 'premium', 'Para negocios establecidos.', 179000.00, 1790000.00, 'COP', NULL, NULL, NULL, NULL, 25, 200, 5000, 3, NULL, 1, 0, 1, 14, 3, '2026-04-28 19:22:24', '2026-04-28 19:22:24', NULL),
(4, 'Empresarial', 'enterprise', 'Cadenas y franquicias.', 349000.00, 3490000.00, 'COP', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, 0, 1, 14, 4, '2026-04-28 19:22:24', '2026-04-28 19:22:24', NULL);

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `plan_modules`
--

CREATE TABLE `plan_modules` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `plan_id` bigint(20) UNSIGNED NOT NULL,
  `module_id` bigint(20) UNSIGNED NOT NULL,
  `is_enabled` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Volcado de datos para la tabla `plan_modules`
--

INSERT INTO `plan_modules` (`id`, `plan_id`, `module_id`, `is_enabled`, `created_at`, `updated_at`) VALUES
(1, 1, 1, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(2, 1, 2, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(3, 1, 3, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(4, 1, 12, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(5, 1, 6, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(6, 1, 5, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(7, 1, 4, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(8, 2, 1, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(9, 2, 9, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(10, 2, 2, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(11, 2, 3, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(12, 2, 10, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(13, 2, 12, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(14, 2, 8, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(15, 2, 6, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(16, 2, 17, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(17, 2, 11, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(18, 2, 7, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(19, 2, 5, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(20, 2, 4, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(21, 3, 19, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(22, 3, 1, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(23, 3, 18, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(24, 3, 22, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(25, 3, 20, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(26, 3, 21, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(27, 3, 9, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(28, 3, 2, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(29, 3, 3, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(30, 3, 10, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(31, 3, 12, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(32, 3, 14, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(33, 3, 8, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(34, 3, 6, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(35, 3, 17, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(36, 3, 11, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(37, 3, 7, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(38, 3, 5, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(39, 3, 4, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(40, 3, 13, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(41, 4, 19, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(42, 4, 1, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(43, 4, 18, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(44, 4, 22, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(45, 4, 20, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(46, 4, 21, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(47, 4, 9, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(48, 4, 2, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(49, 4, 3, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(50, 4, 10, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(51, 4, 15, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(52, 4, 16, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(53, 4, 12, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(54, 4, 14, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(55, 4, 8, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(56, 4, 6, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(57, 4, 17, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(58, 4, 11, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(59, 4, 7, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(60, 4, 5, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(61, 4, 4, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(62, 4, 13, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(63, 2, 20, 1, '2026-05-03 22:14:13', '2026-05-03 22:14:13'),
(64, 2, 21, 1, '2026-05-03 22:14:13', '2026-05-03 22:14:13'),
(65, 2, 22, 1, '2026-05-03 22:14:13', '2026-05-03 22:14:13');

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `prescriptions`
--

CREATE TABLE `prescriptions` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `uuid` char(36) NOT NULL,
  `company_id` bigint(20) UNSIGNED NOT NULL,
  `clinical_history_id` bigint(20) UNSIGNED NOT NULL,
  `clinical_evolution_id` bigint(20) UNSIGNED DEFAULT NULL,
  `customer_id` bigint(20) UNSIGNED NOT NULL,
  `employee_id` bigint(20) UNSIGNED DEFAULT NULL,
  `prescription_number` varchar(50) DEFAULT NULL,
  `diagnosis_summary` text DEFAULT NULL,
  `notes` text DEFAULT NULL,
  `status` enum('draft','signed','cancelled') NOT NULL DEFAULT 'draft',
  `signed_at` timestamp NULL DEFAULT NULL,
  `signed_by` bigint(20) UNSIGNED DEFAULT NULL,
  `created_by` bigint(20) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `prescription_items`
--

CREATE TABLE `prescription_items` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `prescription_id` bigint(20) UNSIGNED NOT NULL,
  `company_id` bigint(20) UNSIGNED NOT NULL,
  `medication` varchar(255) NOT NULL,
  `dose` varchar(255) DEFAULT NULL,
  `frequency` varchar(255) DEFAULT NULL,
  `duration` varchar(255) DEFAULT NULL,
  `route` varchar(255) DEFAULT NULL,
  `instructions` text DEFAULT NULL,
  `notes` text DEFAULT NULL,
  `sort_order` smallint(5) UNSIGNED NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `promotions`
--

CREATE TABLE `promotions` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `company_id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `slug` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `image_path` varchar(255) DEFAULT NULL,
  `discount_type` enum('percentage','fixed') NOT NULL DEFAULT 'percentage',
  `discount_value` decimal(12,2) NOT NULL,
  `applies_to_all_services` tinyint(1) NOT NULL DEFAULT 1,
  `service_ids` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`service_ids`)),
  `starts_at` timestamp NULL DEFAULT NULL,
  `ends_at` timestamp NULL DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `is_featured` tinyint(1) NOT NULL DEFAULT 0,
  `usage_limit` int(10) UNSIGNED DEFAULT NULL,
  `used_count` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Volcado de datos para la tabla `promotions`
--

INSERT INTO `promotions` (`id`, `company_id`, `name`, `slug`, `description`, `image_path`, `discount_type`, `discount_value`, `applies_to_all_services`, `service_ids`, `starts_at`, `ends_at`, `is_active`, `is_featured`, `usage_limit`, `used_count`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 1, 'Corte + Barba = 20%OFF', 'corte-barba-20off-6quo0', 'Si llevas un corte y barba te damos el 20% OFF Aplican terminos y condiciones', NULL, 'percentage', 10.00, 1, NULL, '2026-05-08 03:07:00', '2026-05-15 03:07:00', 1, 1, NULL, 5, '2026-05-08 03:07:53', '2026-05-08 16:55:57', NULL);

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `roles`
--

CREATE TABLE `roles` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `guard_name` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Volcado de datos para la tabla `roles`
--

INSERT INTO `roles` (`id`, `name`, `guard_name`, `created_at`, `updated_at`) VALUES
(1, 'super_admin', 'web', '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(2, 'company_admin', 'web', '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(3, 'employee', 'web', '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(4, 'customer', 'web', '2026-04-28 19:22:24', '2026-04-28 19:22:24');

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `role_has_permissions`
--

CREATE TABLE `role_has_permissions` (
  `permission_id` bigint(20) UNSIGNED NOT NULL,
  `role_id` bigint(20) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Volcado de datos para la tabla `role_has_permissions`
--

INSERT INTO `role_has_permissions` (`permission_id`, `role_id`) VALUES
(1, 1),
(2, 1),
(3, 1),
(4, 1),
(5, 1),
(6, 1),
(7, 1),
(8, 1),
(8, 2),
(9, 1),
(9, 2),
(10, 1),
(10, 2),
(11, 1),
(11, 2),
(12, 1),
(12, 2),
(13, 1),
(13, 2),
(14, 1),
(14, 2),
(15, 1),
(15, 2),
(15, 3),
(16, 1),
(16, 2),
(17, 1),
(17, 2),
(17, 3),
(18, 1),
(18, 2),
(19, 1),
(19, 2),
(20, 1),
(20, 2),
(21, 1),
(21, 2),
(22, 1),
(22, 2),
(23, 1),
(23, 2),
(24, 1),
(24, 2),
(25, 1),
(25, 2),
(26, 1),
(26, 2),
(27, 1),
(27, 2),
(28, 1),
(28, 2),
(29, 1),
(29, 2),
(30, 1),
(30, 2),
(31, 1),
(31, 3),
(32, 1),
(32, 3);

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `schedules`
--

CREATE TABLE `schedules` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `company_id` bigint(20) UNSIGNED NOT NULL,
  `branch_id` bigint(20) UNSIGNED DEFAULT NULL,
  `employee_id` bigint(20) UNSIGNED DEFAULT NULL,
  `weekday` tinyint(3) UNSIGNED NOT NULL,
  `start_time` time NOT NULL,
  `end_time` time NOT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Volcado de datos para la tabla `schedules`
--

INSERT INTO `schedules` (`id`, `company_id`, `branch_id`, `employee_id`, `weekday`, `start_time`, `end_time`, `is_active`, `created_at`, `updated_at`) VALUES
(1, 1, 1, 1, 1, '09:00:00', '18:00:00', 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(2, 1, 1, 1, 2, '09:00:00', '18:00:00', 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(3, 1, 1, 1, 3, '09:00:00', '18:00:00', 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(4, 1, 1, 1, 4, '09:00:00', '18:00:00', 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(5, 1, 1, 1, 5, '09:00:00', '18:00:00', 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(6, 1, 1, 1, 6, '09:00:00', '14:00:00', 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(13, 1, 1, 3, 1, '09:00:00', '18:00:00', 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(14, 1, 1, 3, 2, '09:00:00', '18:00:00', 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(15, 1, 1, 3, 3, '09:00:00', '18:00:00', 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(16, 1, 1, 3, 4, '09:00:00', '18:00:00', 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(17, 1, 1, 3, 5, '09:00:00', '18:00:00', 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(18, 1, 1, 3, 6, '09:00:00', '14:00:00', 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24'),
(19, 1, 1, 2, 1, '09:00:00', '13:00:00', 1, '2026-05-04 15:38:25', '2026-05-04 15:38:25'),
(20, 1, 1, 2, 2, '09:00:00', '18:00:00', 1, '2026-05-04 15:38:25', '2026-05-04 15:38:25'),
(21, 1, 1, 2, 3, '09:00:00', '18:00:00', 1, '2026-05-04 15:38:25', '2026-05-04 15:38:25'),
(22, 1, 1, 2, 4, '09:00:00', '18:00:00', 1, '2026-05-04 15:38:25', '2026-05-04 15:38:25'),
(23, 1, 1, 2, 5, '09:00:00', '18:00:00', 1, '2026-05-04 15:38:25', '2026-05-04 15:38:25'),
(24, 1, 1, 2, 6, '09:00:00', '14:00:00', 1, '2026-05-04 15:38:25', '2026-05-04 15:38:25');

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `schedule_blocks`
--

CREATE TABLE `schedule_blocks` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `company_id` bigint(20) UNSIGNED NOT NULL,
  `branch_id` bigint(20) UNSIGNED DEFAULT NULL,
  `employee_id` bigint(20) UNSIGNED DEFAULT NULL,
  `type` enum('holiday','vacation','break','sick','custom') NOT NULL DEFAULT 'custom',
  `reason` varchar(255) DEFAULT NULL,
  `starts_at` datetime NOT NULL,
  `ends_at` datetime NOT NULL,
  `is_full_day` tinyint(1) NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `services`
--

CREATE TABLE `services` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `company_id` bigint(20) UNSIGNED NOT NULL,
  `service_category_id` bigint(20) UNSIGNED DEFAULT NULL,
  `name` varchar(255) NOT NULL,
  `slug` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `image_path` varchar(255) DEFAULT NULL,
  `price` decimal(12,2) NOT NULL DEFAULT 0.00,
  `promo_price` decimal(12,2) DEFAULT NULL,
  `duration_minutes` int(10) UNSIGNED NOT NULL DEFAULT 30,
  `buffer_minutes` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `cancellation_min_notice_minutes` int(10) UNSIGNED DEFAULT NULL,
  `requires_deposit` tinyint(1) NOT NULL DEFAULT 0,
  `deposit_amount` decimal(12,2) DEFAULT NULL,
  `is_home_service` tinyint(1) NOT NULL DEFAULT 0,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `is_public` tinyint(1) NOT NULL DEFAULT 1,
  `sort_order` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Volcado de datos para la tabla `services`
--

INSERT INTO `services` (`id`, `company_id`, `service_category_id`, `name`, `slug`, `description`, `image_path`, `price`, `promo_price`, `duration_minutes`, `buffer_minutes`, `cancellation_min_notice_minutes`, `requires_deposit`, `deposit_amount`, `is_home_service`, `is_active`, `is_public`, `sort_order`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 1, 1, 'Corte clásico', 'corte-clasico', NULL, 'services/xDhSOEnb4wnJEwBabtFQPPf58JQdLK90BsjR0Pz8.jpg', 25000.00, NULL, 30, 0, NULL, 0, NULL, 0, 1, 1, 0, '2026-04-28 19:22:24', '2026-05-04 01:16:33', NULL),
(2, 1, 1, 'Corte + barba', 'corte-barba', NULL, 'services/7tj7fxkYY3IdL0bi8LHssFM8kyOfHHzhZsScHZwS.jpg', 35000.00, NULL, 45, 0, NULL, 0, NULL, 0, 1, 1, 0, '2026-04-28 19:22:24', '2026-05-04 01:16:24', NULL),
(3, 1, 1, 'Barba', 'arreglo-de-barba', NULL, 'services/dn3Un84a6wZ2wGtmoqMQQthfgHSSf62iK8cTPiAf.jpg', 15000.00, NULL, 20, 0, 20, 0, NULL, 0, 1, 1, 0, '2026-04-28 19:22:24', '2026-05-04 01:16:15', NULL),
(4, 1, 1, 'Tinte', 'tinte', NULL, 'services/CX9m0u4RAe9Q8KhkhmVwk6UfXTR1VHVAHLwybVW1.jpg', 60000.00, NULL, 60, 0, NULL, 0, NULL, 0, 1, 1, 0, '2026-04-28 19:22:24', '2026-05-04 01:16:43', NULL);

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `service_categories`
--

CREATE TABLE `service_categories` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `company_id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `slug` varchar(255) NOT NULL,
  `icon` varchar(50) DEFAULT NULL,
  `color` varchar(7) DEFAULT NULL,
  `description` text DEFAULT NULL,
  `sort_order` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Volcado de datos para la tabla `service_categories`
--

INSERT INTO `service_categories` (`id`, `company_id`, `name`, `slug`, `icon`, `color`, `description`, `sort_order`, `is_active`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 1, 'Barbería', 'barberia', 'scissors', '#0f172a', NULL, 0, 1, '2026-04-28 19:22:24', '2026-04-28 19:22:24', NULL);

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `sessions`
--

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
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Volcado de datos para la tabla `sessions`
--

INSERT INTO `sessions` (`id`, `user_id`, `ip_address`, `user_agent`, `payload`, `last_activity`) VALUES
('0DCDpu6V0gciNf5nQX1y7xDSkwaIsoaA4AtMs6xo', NULL, '127.0.0.1', 'Codex local server discovery', 'YTozOntzOjY6Il90b2tlbiI7czo0MDoiT0o1eG9DaGhhYVkwMG5XY0NBY3ZCWmFId2p3QnowRjd3UEVOeTNBTiI7czo5OiJfcHJldmlvdXMiO2E6MTp7czozOiJ1cmwiO3M6Mjc6Imh0dHA6Ly9sb2NhbGhvc3Q6ODAwMC9sb2dpbiI7fXM6NjoiX2ZsYXNoIjthOjI6e3M6Mzoib2xkIjthOjA6e31zOjM6Im5ldyI7YTowOnt9fX0=', 1778502711),
('3Hyo3feW7SBBkR6Hy6a7LlOpeNh7aQyaKyxTp4fl', NULL, '127.0.0.1', 'Codex local server discovery', 'YTozOntzOjY6Il90b2tlbiI7czo0MDoieXZxbkdMVURpRjQwbmdCWlBQNWhQaVY5S2IyNU5FMFVIdUllNVZsSiI7czo5OiJfcHJldmlvdXMiO2E6MTp7czozOiJ1cmwiO3M6Mjc6Imh0dHA6Ly9sb2NhbGhvc3Q6ODAwMC9sb2dpbiI7fXM6NjoiX2ZsYXNoIjthOjI6e3M6Mzoib2xkIjthOjA6e31zOjM6Im5ldyI7YTowOnt9fX0=', 1778502723),
('3YCylH6FWZncc2dnm0XXETvcKsBKLeFJuaovBrON', NULL, '127.0.0.1', 'Codex local server discovery', 'YTozOntzOjY6Il90b2tlbiI7czo0MDoiUnJNMGllU0JxWlZaSENseVNHS0IyanJLckU5c0dtdWVqRU9nbHltdCI7czo5OiJfcHJldmlvdXMiO2E6MTp7czozOiJ1cmwiO3M6Mjc6Imh0dHA6Ly9sb2NhbGhvc3Q6ODAwMC9sb2dpbiI7fXM6NjoiX2ZsYXNoIjthOjI6e3M6Mzoib2xkIjthOjA6e31zOjM6Im5ldyI7YTowOnt9fX0=', 1778502723),
('5FxRVaI9gpGiZAxQCAPPHjHO6Ht8Te6pUVSQtP6i', NULL, '127.0.0.1', 'Codex local server discovery', 'YTo0OntzOjY6Il90b2tlbiI7czo0MDoiRTg2ZU52VXRTSUhBU3ZDdnVyRU10SDhKYnQwVTFIMjdhSjM2bXQ3SSI7czozOiJ1cmwiO2E6MTp7czo4OiJpbnRlbmRlZCI7czozOToiaHR0cDovL2xvY2FsaG9zdDo4MDAwL2VtcHJlc2EvZGFzaGJvYXJkIjt9czo5OiJfcHJldmlvdXMiO2E6MTp7czozOiJ1cmwiO3M6Mzk6Imh0dHA6Ly9sb2NhbGhvc3Q6ODAwMC9lbXByZXNhL2Rhc2hib2FyZCI7fXM6NjoiX2ZsYXNoIjthOjI6e3M6Mzoib2xkIjthOjA6e31zOjM6Im5ldyI7YTowOnt9fX0=', 1778502723),
('8YtSEng7QoQ4Ln8MaY9NIKJifBTZTTFm2zQWTPF6', NULL, '127.0.0.1', 'Codex local server discovery', 'YTo0OntzOjY6Il90b2tlbiI7czo0MDoiY0NqODZtTXpxT2h2TWdWdml0OExpSlRtSFRXT25oUHJpOGRFc3JYbyI7czozOiJ1cmwiO2E6MTp7czo4OiJpbnRlbmRlZCI7czozOToiaHR0cDovL2xvY2FsaG9zdDo4MDAwL2VtcHJlc2EvZW1wbG95ZWVzIjt9czo5OiJfcHJldmlvdXMiO2E6MTp7czozOiJ1cmwiO3M6Mzk6Imh0dHA6Ly9sb2NhbGhvc3Q6ODAwMC9lbXByZXNhL2VtcGxveWVlcyI7fXM6NjoiX2ZsYXNoIjthOjI6e3M6Mzoib2xkIjthOjA6e31zOjM6Im5ldyI7YTowOnt9fX0=', 1778502723),
('cloXTia2TRdXW94BKDMorVwaW5y5zbtp46lFrH8c', NULL, '127.0.0.1', 'Codex local server discovery', 'YTozOntzOjY6Il90b2tlbiI7czo0MDoidzloRzhrVmhyQ0dVR2s0aDNFVFA1WVZvNGp3YU5BdkcxTzRkc2JSUiI7czo5OiJfcHJldmlvdXMiO2E6MTp7czozOiJ1cmwiO3M6MjE6Imh0dHA6Ly9sb2NhbGhvc3Q6ODAwMCI7fXM6NjoiX2ZsYXNoIjthOjI6e3M6Mzoib2xkIjthOjA6e31zOjM6Im5ldyI7YTowOnt9fX0=', 1778502711),
('CUP6xWXHzvFlXMV5xQyWR7ssdZ1WcElQyNMb1zqt', 2, '127.0.0.1', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Codex/26.506.21252 Chrome/146.0.7680.179 Electron/41.2.0 Safari/537.36', 'YTo0OntzOjY6Il90b2tlbiI7czo0MDoid0NvbUlpZnF1aWxHZnI0V0pJcHloMU56VVZjNk5BSlpQWjREaHFkSyI7czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319czo5OiJfcHJldmlvdXMiO2E6MTp7czozOiJ1cmwiO3M6ODI6Imh0dHA6Ly9sb2NhbGhvc3Q6ODAwMC9tZWRpYS9lbXBsb3llZXMvY1E5cldtUWxrV0dFdDkzbjdiQUxhYVRYZ0JKMWJLZG1iYXJHT2hWbC5qcGciO31zOjUwOiJsb2dpbl93ZWJfNTliYTM2YWRkYzJiMmY5NDAxNTgwZjAxNGM3ZjU4ZWE0ZTMwOTg5ZCI7aToyO30=', 1778502854),
('DqIwSqHlFnCM6AObYnwovWV3ZueCQiO7n09YiSe1', NULL, '127.0.0.1', 'Codex local server discovery', 'YTo0OntzOjY6Il90b2tlbiI7czo0MDoic0gzR0c5ak5RSVlCbmt0ZzcwdXVTREtHaEtkUzhlRHI2UndMRjlOMSI7czozOiJ1cmwiO2E6MTp7czo4OiJpbnRlbmRlZCI7czozODoiaHR0cDovL2xvY2FsaG9zdDo4MDAwL2VtcHJlc2EvYm9va2luZ3MiO31zOjk6Il9wcmV2aW91cyI7YToxOntzOjM6InVybCI7czozODoiaHR0cDovL2xvY2FsaG9zdDo4MDAwL2VtcHJlc2EvYm9va2luZ3MiO31zOjY6Il9mbGFzaCI7YToyOntzOjM6Im9sZCI7YTowOnt9czozOiJuZXciO2E6MDp7fX19', 1778502723),
('DSTfEu7iJMGLSRKoTXFpj4CD7jyk5UyJPUyNfPIc', 1, '127.0.0.1', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Codex/26.506.21252 Chrome/146.0.7680.179 Electron/41.2.0 Safari/537.36', 'YTo1OntzOjY6Il90b2tlbiI7czo0MDoid3ZEcVJSSkVyVEkwN0RwSDM1Qzh3MzdJT01pMFlwMkJORGR5TnlSRSI7czo5OiJfcHJldmlvdXMiO2E6MTp7czozOiJ1cmwiO3M6MzI6Imh0dHA6Ly9sb2NhbGhvc3Q6ODAwMC9zdXBlcmFkbWluIjt9czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319czozOiJ1cmwiO2E6MDp7fXM6NTA6ImxvZ2luX3dlYl81OWJhMzZhZGRjMmIyZjk0MDE1ODBmMDE0YzdmNThlYTRlMzA5ODlkIjtpOjE7fQ==', 1778502602),
('eN4QtakJhqqQOCWY7Ok8GeMtHyoqxrYViotgU6zo', NULL, '127.0.0.1', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36', 'YTozOntzOjY6Il90b2tlbiI7czo0MDoiQW9aZjdTTmc4T1dkazFzYzhIRzJNUkQ2ckg0WW9DdTNHSjZCRjRsNyI7czo5OiJfcHJldmlvdXMiO2E6MTp7czozOiJ1cmwiO3M6Mjk6Imh0dHA6Ly9sb2NhbGhvc3Q6ODAwMC9vZmZsaW5lIjt9czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319fQ==', 1778502559),
('erpIMrjEaDvKZV8QlgJefxKfwkmo8phslysCSSYS', NULL, '127.0.0.1', 'Codex local server discovery', 'YTozOntzOjY6Il90b2tlbiI7czo0MDoiUHNtQ3ZpVkV6amgwR2JCMjRDVFIxYnBpdHYzdkhYbk1DclV1VTZQRSI7czo5OiJfcHJldmlvdXMiO2E6MTp7czozOiJ1cmwiO3M6Mjc6Imh0dHA6Ly9sb2NhbGhvc3Q6ODAwMC9sb2dpbiI7fXM6NjoiX2ZsYXNoIjthOjI6e3M6Mzoib2xkIjthOjA6e31zOjM6Im5ldyI7YTowOnt9fX0=', 1778502723),
('FcIYNcFGIrF5BFohz5ASmsEyp7Y6n63692bvGQ1Q', NULL, '127.0.0.1', 'Codex local server discovery', 'YTo0OntzOjY6Il90b2tlbiI7czo0MDoic1NZOFlhWm5wbWdtUjREZGczdVlGazJLOXhkbTB0WXpjRzV3UWhybSI7czozOiJ1cmwiO2E6MTp7czo4OiJpbnRlbmRlZCI7czoyOToiaHR0cDovL2xvY2FsaG9zdDo4MDAwL3Byb2ZpbGUiO31zOjk6Il9wcmV2aW91cyI7YToxOntzOjM6InVybCI7czoyOToiaHR0cDovL2xvY2FsaG9zdDo4MDAwL3Byb2ZpbGUiO31zOjY6Il9mbGFzaCI7YToyOntzOjM6Im9sZCI7YTowOnt9czozOiJuZXciO2E6MDp7fX19', 1778502723),
('GwiNLnVoFmz9Uj9GHTi5gOPymd9VbatLEiEI2mF0', NULL, '127.0.0.1', 'Codex local server discovery', 'YTozOntzOjY6Il90b2tlbiI7czo0MDoiaEg3TnppRk54THBZWXh5ZTU0VlpiWGlsR1BQam11dGlESXV3bDdCQSI7czo5OiJfcHJldmlvdXMiO2E6MTp7czozOiJ1cmwiO3M6Mjc6Imh0dHA6Ly9sb2NhbGhvc3Q6ODAwMC9sb2dpbiI7fXM6NjoiX2ZsYXNoIjthOjI6e3M6Mzoib2xkIjthOjA6e31zOjM6Im5ldyI7YTowOnt9fX0=', 1778502723),
('JaUgIlh75WcM7nsWvTbxU7dJWFxSqHMZcqghHbWG', NULL, '127.0.0.1', 'Codex local server discovery', 'YTozOntzOjY6Il90b2tlbiI7czo0MDoieWZza0ZPVXZvQUduUTlPMWZueDZIcXh3WjNvQkpFVXpPT1kwc0s4QiI7czo5OiJfcHJldmlvdXMiO2E6MTp7czozOiJ1cmwiO3M6Mjc6Imh0dHA6Ly9sb2NhbGhvc3Q6ODAwMC9sb2dpbiI7fXM6NjoiX2ZsYXNoIjthOjI6e3M6Mzoib2xkIjthOjA6e31zOjM6Im5ldyI7YTowOnt9fX0=', 1778502722),
('qQHAkZNFVFqnD4NjUmY4GE360MOT0WCTMX9XFF9j', NULL, '127.0.0.1', 'Codex local server discovery', 'YTozOntzOjY6Il90b2tlbiI7czo0MDoiamRmSjVzMldKbzVOeDZyYlVNTUxHTlVmVjRpamRwUzdoV1lWbElhUiI7czo5OiJfcHJldmlvdXMiO2E6MTp7czozOiJ1cmwiO3M6NDM6Imh0dHA6Ly9sb2NhbGhvc3Q6ODAwMC9lbXByZXNhL2JhcmJlcmlhLWRlbW8iO31zOjY6Il9mbGFzaCI7YToyOntzOjM6Im9sZCI7YTowOnt9czozOiJuZXciO2E6MDp7fX19', 1778502722),
('xnlVwtNQZLkER5HqGd3fxspEcjBAY1ClMRF6rozt', NULL, '127.0.0.1', 'Codex local server discovery', 'YTozOntzOjY6Il90b2tlbiI7czo0MDoiZDNQU2p6VnBkb2NQeWFFNXp4OGRleWhhaEJ1bDNvdGFRNXJ4UFhSVyI7czo5OiJfcHJldmlvdXMiO2E6MTp7czozOiJ1cmwiO3M6MjE6Imh0dHA6Ly9sb2NhbGhvc3Q6ODAwMCI7fXM6NjoiX2ZsYXNoIjthOjI6e3M6Mzoib2xkIjthOjA6e31zOjM6Im5ldyI7YTowOnt9fX0=', 1778502722),
('YajZUJ0nkNsilPTljEmC3IWSZ8UEyRpRcqdT6uI8', NULL, '127.0.0.1', 'Codex local server discovery', 'YTozOntzOjY6Il90b2tlbiI7czo0MDoiZkl4ODNxOEhZZ1NCUmd0UGFrSWl4cXJpWjJKMDJTWnNUN3VOR0dvMyI7czo5OiJfcHJldmlvdXMiO2E6MTp7czozOiJ1cmwiO3M6NDM6Imh0dHA6Ly9sb2NhbGhvc3Q6ODAwMC9lbXByZXNhL2JhcmJlcmlhLWRlbW8iO31zOjY6Il9mbGFzaCI7YToyOntzOjM6Im9sZCI7YTowOnt9czozOiJuZXciO2E6MDp7fX19', 1778502723),
('Z2S7dOm5emk6vEmJ954fbznLo3Ih3akhHYdFWFAI', NULL, '127.0.0.1', 'Codex local server discovery', 'YTozOntzOjY6Il90b2tlbiI7czo0MDoiRXR4UTFzbHBEYnh3UHEwbkIyRHducm9KbUh2d0pyU1hzRFR3MXY0YSI7czo5OiJfcHJldmlvdXMiO2E6MTp7czozOiJ1cmwiO3M6NDM6Imh0dHA6Ly9sb2NhbGhvc3Q6ODAwMC9lbXByZXNhL2JhcmJlcmlhLWRlbW8iO31zOjY6Il9mbGFzaCI7YToyOntzOjM6Im9sZCI7YTowOnt9czozOiJuZXciO2E6MDp7fX19', 1778502722),
('zpVV38ZKPhRBPyfeLp0TlrXItt1igfnltmC6P1ND', NULL, '127.0.0.1', 'Codex local server discovery', 'YTozOntzOjY6Il90b2tlbiI7czo0MDoiZVJwQ0RvbVM1S2Y5c29SMmxHSW1kR21acVNYNjE5UUt5dnI1QVRhNCI7czo5OiJfcHJldmlvdXMiO2E6MTp7czozOiJ1cmwiO3M6NDM6Imh0dHA6Ly9sb2NhbGhvc3Q6ODAwMC9lbXByZXNhL2JhcmJlcmlhLWRlbW8iO31zOjY6Il9mbGFzaCI7YToyOntzOjM6Im9sZCI7YTowOnt9czozOiJuZXciO2E6MDp7fX19', 1778502723);

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `subscriptions`
--

CREATE TABLE `subscriptions` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `company_id` bigint(20) UNSIGNED NOT NULL,
  `plan_id` bigint(20) UNSIGNED NOT NULL,
  `status` enum('trial','active','past_due','cancelled','expired') NOT NULL DEFAULT 'trial',
  `billing_cycle` enum('monthly','yearly') NOT NULL DEFAULT 'monthly',
  `amount` decimal(12,2) NOT NULL DEFAULT 0.00,
  `currency` varchar(3) NOT NULL DEFAULT 'COP',
  `trial_starts_at` timestamp NULL DEFAULT NULL,
  `trial_ends_at` timestamp NULL DEFAULT NULL,
  `current_period_start` timestamp NULL DEFAULT NULL,
  `current_period_end` timestamp NULL DEFAULT NULL,
  `cancelled_at` timestamp NULL DEFAULT NULL,
  `ended_at` timestamp NULL DEFAULT NULL,
  `coupon_code` varchar(50) DEFAULT NULL,
  `discount_amount` decimal(12,2) NOT NULL DEFAULT 0.00,
  `metadata` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`metadata`)),
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Volcado de datos para la tabla `subscriptions`
--

INSERT INTO `subscriptions` (`id`, `company_id`, `plan_id`, `status`, `billing_cycle`, `amount`, `currency`, `trial_starts_at`, `trial_ends_at`, `current_period_start`, `current_period_end`, `cancelled_at`, `ended_at`, `coupon_code`, `discount_amount`, `metadata`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 1, 2, 'active', 'monthly', 99000.00, 'COP', '2026-04-14 19:22:24', '2026-04-28 19:22:24', '2026-04-28 19:22:24', '2026-05-28 19:22:24', NULL, NULL, NULL, 0.00, NULL, '2026-04-28 19:22:24', '2026-04-28 19:22:24', NULL);

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `subscription_payments`
--

CREATE TABLE `subscription_payments` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `subscription_id` bigint(20) UNSIGNED NOT NULL,
  `company_id` bigint(20) UNSIGNED NOT NULL,
  `reference` varchar(255) NOT NULL,
  `driver` varchar(50) NOT NULL DEFAULT 'manual',
  `external_id` varchar(255) DEFAULT NULL,
  `status` enum('pending','paid','failed','refunded','cancelled') NOT NULL DEFAULT 'pending',
  `amount` decimal(12,2) NOT NULL,
  `currency` varchar(3) NOT NULL DEFAULT 'COP',
  `paid_at` timestamp NULL DEFAULT NULL,
  `period_start` timestamp NULL DEFAULT NULL,
  `period_end` timestamp NULL DEFAULT NULL,
  `receipt_path` varchar(255) DEFAULT NULL,
  `gateway_response` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`gateway_response`)),
  `notes` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Volcado de datos para la tabla `subscription_payments`
--

INSERT INTO `subscription_payments` (`id`, `subscription_id`, `company_id`, `reference`, `driver`, `external_id`, `status`, `amount`, `currency`, `paid_at`, `period_start`, `period_end`, `receipt_path`, `gateway_response`, `notes`, `created_at`, `updated_at`) VALUES
(1, 1, 1, 'RES-20260428200850-1', 'manual', NULL, 'pending', 99000.00, 'COP', NULL, '2026-04-28 19:22:24', '2026-05-28 19:22:24', NULL, '{\"message\":\"Registra el pago manualmente cuando recibas el comprobante.\"}', NULL, '2026-04-29 01:08:50', '2026-04-29 01:08:50');

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `treatment_records`
--

CREATE TABLE `treatment_records` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `company_id` bigint(20) UNSIGNED NOT NULL,
  `clinical_history_id` bigint(20) UNSIGNED NOT NULL,
  `booking_id` bigint(20) UNSIGNED DEFAULT NULL,
  `service_id` bigint(20) UNSIGNED DEFAULT NULL,
  `employee_id` bigint(20) UNSIGNED DEFAULT NULL,
  `performed_at` date NOT NULL,
  `description` text DEFAULT NULL,
  `products_used` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`products_used`)),
  `observations` text DEFAULT NULL,
  `recommendations` text DEFAULT NULL,
  `next_appointment_suggested` date DEFAULT NULL,
  `photo_before_path` varchar(255) DEFAULT NULL,
  `photo_after_path` varchar(255) DEFAULT NULL,
  `additional_photos` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`additional_photos`)),
  `client_signature_path` varchar(255) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Índices para tablas volcadas
--

--
-- Indices de la tabla `activity_log`
--
ALTER TABLE `activity_log`
  ADD PRIMARY KEY (`id`),
  ADD KEY `subject` (`subject_type`,`subject_id`),
  ADD KEY `causer` (`causer_type`,`causer_id`),
  ADD KEY `activity_log_log_name_index` (`log_name`);

--
-- Indices de la tabla `app_notifications`
--
ALTER TABLE `app_notifications`
  ADD PRIMARY KEY (`id`),
  ADD KEY `app_notifications_user_id_read_at_index` (`user_id`,`read_at`),
  ADD KEY `app_notifications_company_id_type_created_at_index` (`company_id`,`type`,`created_at`);

--
-- Indices de la tabla `bookings`
--
ALTER TABLE `bookings`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `bookings_uuid_unique` (`uuid`),
  ADD UNIQUE KEY `bookings_code_unique` (`code`),
  ADD KEY `bookings_branch_id_foreign` (`branch_id`),
  ADD KEY `bookings_customer_id_foreign` (`customer_id`),
  ADD KEY `bookings_service_id_foreign` (`service_id`),
  ADD KEY `bookings_employee_id_foreign` (`employee_id`),
  ADD KEY `bookings_cancelled_by_foreign` (`cancelled_by`),
  ADD KEY `bookings_company_id_status_scheduled_at_index` (`company_id`,`status`,`scheduled_at`),
  ADD KEY `bookings_company_id_employee_id_scheduled_at_index` (`company_id`,`employee_id`,`scheduled_at`),
  ADD KEY `bookings_company_id_customer_id_scheduled_at_index` (`company_id`,`customer_id`,`scheduled_at`),
  ADD KEY `bookings_company_id_booking_date_index` (`company_id`,`booking_date`),
  ADD KEY `bookings_scheduled_at_index` (`scheduled_at`);

--
-- Indices de la tabla `booking_status_history`
--
ALTER TABLE `booking_status_history`
  ADD PRIMARY KEY (`id`),
  ADD KEY `booking_status_history_booking_id_foreign` (`booking_id`),
  ADD KEY `booking_status_history_changed_by_foreign` (`changed_by`),
  ADD KEY `booking_status_history_company_id_booking_id_index` (`company_id`,`booking_id`);

--
-- Indices de la tabla `branches`
--
ALTER TABLE `branches`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `branches_company_id_slug_unique` (`company_id`,`slug`),
  ADD KEY `branches_company_id_is_active_index` (`company_id`,`is_active`);

--
-- Indices de la tabla `cash_movements`
--
ALTER TABLE `cash_movements`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `cash_movements_uuid_unique` (`uuid`),
  ADD KEY `cash_movements_user_id_foreign` (`user_id`),
  ADD KEY `cash_movements_booking_id_foreign` (`booking_id`),
  ADD KEY `cash_movements_company_id_type_occurred_at_index` (`company_id`,`type`,`occurred_at`),
  ADD KEY `cash_movements_company_id_status_occurred_at_index` (`company_id`,`status`,`occurred_at`),
  ADD KEY `cash_movements_company_id_payment_method_occurred_at_index` (`company_id`,`payment_method`,`occurred_at`);

--
-- Indices de la tabla `client_conditions`
--
ALTER TABLE `client_conditions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `client_conditions_clinical_history_id_foreign` (`clinical_history_id`),
  ADD KEY `client_conditions_company_id_clinical_history_id_type_index` (`company_id`,`clinical_history_id`,`type`),
  ADD KEY `client_conditions_company_id_severity_is_active_index` (`company_id`,`severity`,`is_active`);

--
-- Indices de la tabla `client_files`
--
ALTER TABLE `client_files`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `client_files_uuid_unique` (`uuid`),
  ADD KEY `client_files_clinical_history_id_foreign` (`clinical_history_id`),
  ADD KEY `client_files_booking_id_foreign` (`booking_id`),
  ADD KEY `client_files_uploaded_by_foreign` (`uploaded_by`),
  ADD KEY `client_files_company_id_clinical_history_id_type_index` (`company_id`,`clinical_history_id`,`type`);

--
-- Indices de la tabla `clinical_backgrounds`
--
ALTER TABLE `clinical_backgrounds`
  ADD PRIMARY KEY (`id`),
  ADD KEY `clinical_backgrounds_clinical_history_id_foreign` (`clinical_history_id`),
  ADD KEY `clinical_backgrounds_customer_id_foreign` (`customer_id`),
  ADD KEY `clinical_backgrounds_created_by_foreign` (`created_by`),
  ADD KEY `clinical_backgrounds_company_id_clinical_history_id_type_index` (`company_id`,`clinical_history_id`,`type`);

--
-- Indices de la tabla `clinical_diagnoses`
--
ALTER TABLE `clinical_diagnoses`
  ADD PRIMARY KEY (`id`),
  ADD KEY `clinical_diagnoses_clinical_history_id_foreign` (`clinical_history_id`),
  ADD KEY `clinical_diagnoses_clinical_evolution_id_foreign` (`clinical_evolution_id`),
  ADD KEY `clinical_diagnoses_customer_id_foreign` (`customer_id`),
  ADD KEY `clinical_diagnoses_created_by_foreign` (`created_by`),
  ADD KEY `clinical_diagnoses_company_id_clinical_history_id_index` (`company_id`,`clinical_history_id`);

--
-- Indices de la tabla `clinical_evolutions`
--
ALTER TABLE `clinical_evolutions`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `clinical_evolutions_uuid_unique` (`uuid`),
  ADD KEY `clinical_evolutions_clinical_history_id_foreign` (`clinical_history_id`),
  ADD KEY `clinical_evolutions_customer_id_foreign` (`customer_id`),
  ADD KEY `clinical_evolutions_booking_id_foreign` (`booking_id`),
  ADD KEY `clinical_evolutions_employee_id_foreign` (`employee_id`),
  ADD KEY `clinical_evolutions_signed_by_foreign` (`signed_by`),
  ADD KEY `clinical_evolutions_created_by_foreign` (`created_by`),
  ADD KEY `clinical_evolutions_updated_by_foreign` (`updated_by`),
  ADD KEY `clinical_evolutions_company_id_clinical_history_id_status_index` (`company_id`,`clinical_history_id`,`status`),
  ADD KEY `clinical_evolutions_company_id_employee_id_index` (`company_id`,`employee_id`);

--
-- Indices de la tabla `clinical_histories`
--
ALTER TABLE `clinical_histories`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `clinical_histories_company_id_customer_id_unique` (`company_id`,`customer_id`),
  ADD UNIQUE KEY `clinical_histories_uuid_unique` (`uuid`),
  ADD UNIQUE KEY `clinical_histories_company_id_history_number_unique` (`company_id`,`history_number`),
  ADD KEY `clinical_histories_customer_id_foreign` (`customer_id`),
  ADD KEY `clinical_histories_created_by_foreign` (`created_by`),
  ADD KEY `clinical_histories_updated_by_foreign` (`updated_by`);

--
-- Indices de la tabla `clinical_notes`
--
ALTER TABLE `clinical_notes`
  ADD PRIMARY KEY (`id`),
  ADD KEY `clinical_notes_clinical_history_id_foreign` (`clinical_history_id`),
  ADD KEY `clinical_notes_booking_id_foreign` (`booking_id`),
  ADD KEY `clinical_notes_employee_id_foreign` (`employee_id`),
  ADD KEY `clinical_notes_created_by_foreign` (`created_by`),
  ADD KEY `clinical_notes_company_id_clinical_history_id_index` (`company_id`,`clinical_history_id`);

--
-- Indices de la tabla `clinical_orders`
--
ALTER TABLE `clinical_orders`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `clinical_orders_uuid_unique` (`uuid`),
  ADD KEY `clinical_orders_clinical_history_id_foreign` (`clinical_history_id`),
  ADD KEY `clinical_orders_clinical_evolution_id_foreign` (`clinical_evolution_id`),
  ADD KEY `clinical_orders_customer_id_foreign` (`customer_id`),
  ADD KEY `clinical_orders_employee_id_foreign` (`employee_id`),
  ADD KEY `clinical_orders_signed_by_foreign` (`signed_by`),
  ADD KEY `clinical_orders_created_by_foreign` (`created_by`),
  ADD KEY `clinical_orders_company_id_customer_id_type_index` (`company_id`,`customer_id`,`type`);

--
-- Indices de la tabla `companies`
--
ALTER TABLE `companies`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `companies_uuid_unique` (`uuid`),
  ADD UNIQUE KEY `companies_slug_unique` (`slug`),
  ADD KEY `companies_status_subscription_ends_at_index` (`status`,`subscription_ends_at`),
  ADD KEY `companies_plan_id_status_index` (`plan_id`,`status`);

--
-- Indices de la tabla `company_modules`
--
ALTER TABLE `company_modules`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `company_modules_company_id_module_id_unique` (`company_id`,`module_id`),
  ADD KEY `company_modules_module_id_foreign` (`module_id`);

--
-- Indices de la tabla `consent_forms`
--
ALTER TABLE `consent_forms`
  ADD PRIMARY KEY (`id`),
  ADD KEY `consent_forms_clinical_history_id_foreign` (`clinical_history_id`),
  ADD KEY `consent_forms_booking_id_foreign` (`booking_id`),
  ADD KEY `consent_forms_employee_id_foreign` (`employee_id`),
  ADD KEY `consent_forms_company_id_clinical_history_id_status_index` (`company_id`,`clinical_history_id`,`status`);

--
-- Indices de la tabla `consent_templates`
--
ALTER TABLE `consent_templates`
  ADD PRIMARY KEY (`id`),
  ADD KEY `consent_templates_created_by_foreign` (`created_by`),
  ADD KEY `consent_templates_company_id_is_active_index` (`company_id`,`is_active`);

--
-- Indices de la tabla `coupons`
--
ALTER TABLE `coupons`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `coupons_company_id_code_unique` (`company_id`,`code`),
  ADD KEY `coupons_scope_is_active_index` (`scope`,`is_active`);

--
-- Indices de la tabla `customers`
--
ALTER TABLE `customers`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `customers_company_id_phone_unique` (`company_id`,`phone`),
  ADD UNIQUE KEY `customers_uuid_unique` (`uuid`),
  ADD KEY `customers_user_id_foreign` (`user_id`),
  ADD KEY `customers_company_id_phone_index` (`company_id`,`phone`),
  ADD KEY `customers_company_id_email_index` (`company_id`,`email`),
  ADD KEY `customers_company_id_is_frequent_index` (`company_id`,`is_frequent`);

--
-- Indices de la tabla `employees`
--
ALTER TABLE `employees`
  ADD PRIMARY KEY (`id`),
  ADD KEY `employees_user_id_foreign` (`user_id`),
  ADD KEY `employees_branch_id_foreign` (`branch_id`),
  ADD KEY `employees_company_id_is_active_is_bookable_index` (`company_id`,`is_active`,`is_bookable`),
  ADD KEY `employees_company_id_branch_id_index` (`company_id`,`branch_id`);

--
-- Indices de la tabla `employee_services`
--
ALTER TABLE `employee_services`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `employee_services_employee_id_service_id_unique` (`employee_id`,`service_id`),
  ADD KEY `employee_services_service_id_foreign` (`service_id`),
  ADD KEY `employee_services_company_id_service_id_index` (`company_id`,`service_id`);

--
-- Indices de la tabla `failed_jobs`
--
ALTER TABLE `failed_jobs`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`);

--
-- Indices de la tabla `gallery_items`
--
ALTER TABLE `gallery_items`
  ADD PRIMARY KEY (`id`),
  ADD KEY `gallery_items_company_id_is_public_sort_order_index` (`company_id`,`is_public`,`sort_order`);

--
-- Indices de la tabla `jobs`
--
ALTER TABLE `jobs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `jobs_queue_index` (`queue`);

--
-- Indices de la tabla `job_batches`
--
ALTER TABLE `job_batches`
  ADD PRIMARY KEY (`id`);

--
-- Indices de la tabla `migrations`
--
ALTER TABLE `migrations`
  ADD PRIMARY KEY (`id`);

--
-- Indices de la tabla `model_has_permissions`
--
ALTER TABLE `model_has_permissions`
  ADD PRIMARY KEY (`permission_id`,`model_id`,`model_type`),
  ADD KEY `model_has_permissions_model_id_model_type_index` (`model_id`,`model_type`);

--
-- Indices de la tabla `model_has_roles`
--
ALTER TABLE `model_has_roles`
  ADD PRIMARY KEY (`role_id`,`model_id`,`model_type`),
  ADD KEY `model_has_roles_model_id_model_type_index` (`model_id`,`model_type`);

--
-- Indices de la tabla `permissions`
--
ALTER TABLE `permissions`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `permissions_name_guard_name_unique` (`name`,`guard_name`);

--
-- Indices de la tabla `plans`
--
ALTER TABLE `plans`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `plans_slug_unique` (`slug`),
  ADD KEY `plans_is_active_is_public_sort_order_index` (`is_active`,`is_public`,`sort_order`);

--
-- Indices de la tabla `plan_modules`
--
ALTER TABLE `plan_modules`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `plan_modules_plan_id_module_id_unique` (`plan_id`,`module_id`),
  ADD KEY `plan_modules_module_id_foreign` (`module_id`);

--
-- Indices de la tabla `prescriptions`
--
ALTER TABLE `prescriptions`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `prescriptions_uuid_unique` (`uuid`),
  ADD UNIQUE KEY `prescriptions_company_id_prescription_number_unique` (`company_id`,`prescription_number`),
  ADD KEY `prescriptions_clinical_history_id_foreign` (`clinical_history_id`),
  ADD KEY `prescriptions_clinical_evolution_id_foreign` (`clinical_evolution_id`),
  ADD KEY `prescriptions_customer_id_foreign` (`customer_id`),
  ADD KEY `prescriptions_employee_id_foreign` (`employee_id`),
  ADD KEY `prescriptions_signed_by_foreign` (`signed_by`),
  ADD KEY `prescriptions_created_by_foreign` (`created_by`),
  ADD KEY `prescriptions_company_id_customer_id_status_index` (`company_id`,`customer_id`,`status`);

--
-- Indices de la tabla `prescription_items`
--
ALTER TABLE `prescription_items`
  ADD PRIMARY KEY (`id`),
  ADD KEY `prescription_items_prescription_id_foreign` (`prescription_id`),
  ADD KEY `prescription_items_company_id_foreign` (`company_id`);

--
-- Indices de la tabla `promotions`
--
ALTER TABLE `promotions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `promotions_company_id_is_active_starts_at_ends_at_index` (`company_id`,`is_active`,`starts_at`,`ends_at`);

--
-- Indices de la tabla `roles`
--
ALTER TABLE `roles`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `roles_name_guard_name_unique` (`name`,`guard_name`);

--
-- Indices de la tabla `role_has_permissions`
--
ALTER TABLE `role_has_permissions`
  ADD PRIMARY KEY (`permission_id`,`role_id`),
  ADD KEY `role_has_permissions_role_id_foreign` (`role_id`);

--
-- Indices de la tabla `schedules`
--
ALTER TABLE `schedules`
  ADD PRIMARY KEY (`id`),
  ADD KEY `schedules_branch_id_foreign` (`branch_id`),
  ADD KEY `schedules_employee_id_foreign` (`employee_id`),
  ADD KEY `schedules_company_id_employee_id_weekday_index` (`company_id`,`employee_id`,`weekday`),
  ADD KEY `schedules_company_id_branch_id_weekday_index` (`company_id`,`branch_id`,`weekday`);

--
-- Indices de la tabla `schedule_blocks`
--
ALTER TABLE `schedule_blocks`
  ADD PRIMARY KEY (`id`),
  ADD KEY `schedule_blocks_branch_id_foreign` (`branch_id`),
  ADD KEY `schedule_blocks_company_id_starts_at_ends_at_index` (`company_id`,`starts_at`,`ends_at`),
  ADD KEY `schedule_blocks_employee_id_starts_at_ends_at_index` (`employee_id`,`starts_at`,`ends_at`);

--
-- Indices de la tabla `services`
--
ALTER TABLE `services`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `services_company_id_slug_unique` (`company_id`,`slug`),
  ADD KEY `services_service_category_id_foreign` (`service_category_id`),
  ADD KEY `services_company_id_is_active_is_public_index` (`company_id`,`is_active`,`is_public`),
  ADD KEY `services_company_id_service_category_id_sort_order_index` (`company_id`,`service_category_id`,`sort_order`);

--
-- Indices de la tabla `service_categories`
--
ALTER TABLE `service_categories`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `service_categories_company_id_slug_unique` (`company_id`,`slug`),
  ADD KEY `service_categories_company_id_is_active_sort_order_index` (`company_id`,`is_active`,`sort_order`);

--
-- Indices de la tabla `sessions`
--
ALTER TABLE `sessions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `sessions_user_id_index` (`user_id`),
  ADD KEY `sessions_last_activity_index` (`last_activity`);

--
-- Indices de la tabla `subscriptions`
--
ALTER TABLE `subscriptions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `subscriptions_plan_id_foreign` (`plan_id`),
  ADD KEY `subscriptions_company_id_status_index` (`company_id`,`status`),
  ADD KEY `subscriptions_status_current_period_end_index` (`status`,`current_period_end`);

--
-- Indices de la tabla `subscription_payments`
--
ALTER TABLE `subscription_payments`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `subscription_payments_reference_unique` (`reference`),
  ADD KEY `subscription_payments_subscription_id_foreign` (`subscription_id`),
  ADD KEY `subscription_payments_company_id_status_index` (`company_id`,`status`),
  ADD KEY `subscription_payments_paid_at_index` (`paid_at`);

--
-- Indices de la tabla `treatment_records`
--
ALTER TABLE `treatment_records`
  ADD PRIMARY KEY (`id`),
  ADD KEY `treatment_records_clinical_history_id_foreign` (`clinical_history_id`),
  ADD KEY `treatment_records_booking_id_foreign` (`booking_id`),
  ADD KEY `treatment_records_service_id_foreign` (`service_id`),
  ADD KEY `treatment_records_employee_id_foreign` (`employee_id`),
  ADD KEY `treatment_records_company_history_perf_idx` (`company_id`,`clinical_history_id`,`performed_at`);

--
-- AUTO_INCREMENT de las tablas volcadas
--

--
-- AUTO_INCREMENT de la tabla `activity_log`
--
ALTER TABLE `activity_log`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de la tabla `app_notifications`
--
ALTER TABLE `app_notifications`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;

--
-- AUTO_INCREMENT de la tabla `bookings`
--
ALTER TABLE `bookings`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17;

--
-- AUTO_INCREMENT de la tabla `booking_status_history`
--
ALTER TABLE `booking_status_history`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=32;

--
-- AUTO_INCREMENT de la tabla `branches`
--
ALTER TABLE `branches`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT de la tabla `cash_movements`
--
ALTER TABLE `cash_movements`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT de la tabla `client_conditions`
--
ALTER TABLE `client_conditions`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de la tabla `client_files`
--
ALTER TABLE `client_files`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de la tabla `clinical_backgrounds`
--
ALTER TABLE `clinical_backgrounds`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de la tabla `clinical_diagnoses`
--
ALTER TABLE `clinical_diagnoses`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de la tabla `clinical_evolutions`
--
ALTER TABLE `clinical_evolutions`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de la tabla `clinical_histories`
--
ALTER TABLE `clinical_histories`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT de la tabla `clinical_notes`
--
ALTER TABLE `clinical_notes`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de la tabla `clinical_orders`
--
ALTER TABLE `clinical_orders`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de la tabla `companies`
--
ALTER TABLE `companies`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT de la tabla `company_modules`
--
ALTER TABLE `company_modules`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT de la tabla `consent_forms`
--
ALTER TABLE `consent_forms`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de la tabla `consent_templates`
--
ALTER TABLE `consent_templates`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT de la tabla `coupons`
--
ALTER TABLE `coupons`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de la tabla `customers`
--
ALTER TABLE `customers`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;

--
-- AUTO_INCREMENT de la tabla `employees`
--
ALTER TABLE `employees`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT de la tabla `employee_services`
--
ALTER TABLE `employee_services`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;

--
-- AUTO_INCREMENT de la tabla `failed_jobs`
--
ALTER TABLE `failed_jobs`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de la tabla `gallery_items`
--
ALTER TABLE `gallery_items`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT de la tabla `jobs`
--
ALTER TABLE `jobs`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;

--
-- AUTO_INCREMENT de la tabla `migrations`
--
ALTER TABLE `migrations`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=50;

--
-- AUTO_INCREMENT de la tabla `permissions`
--
ALTER TABLE `permissions`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=33;

--
-- AUTO_INCREMENT de la tabla `plans`
--
ALTER TABLE `plans`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT de la tabla `plan_modules`
--
ALTER TABLE `plan_modules`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=66;

--
-- AUTO_INCREMENT de la tabla `prescriptions`
--
ALTER TABLE `prescriptions`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de la tabla `prescription_items`
--
ALTER TABLE `prescription_items`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de la tabla `promotions`
--
ALTER TABLE `promotions`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT de la tabla `roles`
--
ALTER TABLE `roles`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT de la tabla `schedules`
--
ALTER TABLE `schedules`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=25;

--
-- AUTO_INCREMENT de la tabla `schedule_blocks`
--
ALTER TABLE `schedule_blocks`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de la tabla `services`
--
ALTER TABLE `services`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT de la tabla `service_categories`
--
ALTER TABLE `service_categories`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT de la tabla `subscriptions`
--
ALTER TABLE `subscriptions`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT de la tabla `subscription_payments`
--
ALTER TABLE `subscription_payments`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT de la tabla `treatment_records`
--
ALTER TABLE `treatment_records`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- Restricciones para tablas volcadas
--

--
-- Filtros para la tabla `app_notifications`
--
ALTER TABLE `app_notifications`
  ADD CONSTRAINT `app_notifications_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `app_notifications_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Filtros para la tabla `bookings`
--
ALTER TABLE `bookings`
  ADD CONSTRAINT `bookings_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `bookings_cancelled_by_foreign` FOREIGN KEY (`cancelled_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `bookings_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `bookings_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `bookings_employee_id_foreign` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `bookings_service_id_foreign` FOREIGN KEY (`service_id`) REFERENCES `services` (`id`);

--
-- Filtros para la tabla `booking_status_history`
--
ALTER TABLE `booking_status_history`
  ADD CONSTRAINT `booking_status_history_booking_id_foreign` FOREIGN KEY (`booking_id`) REFERENCES `bookings` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `booking_status_history_changed_by_foreign` FOREIGN KEY (`changed_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `booking_status_history_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE;

--
-- Filtros para la tabla `branches`
--
ALTER TABLE `branches`
  ADD CONSTRAINT `branches_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE;

--
-- Filtros para la tabla `cash_movements`
--
ALTER TABLE `cash_movements`
  ADD CONSTRAINT `cash_movements_booking_id_foreign` FOREIGN KEY (`booking_id`) REFERENCES `bookings` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `cash_movements_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `cash_movements_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Filtros para la tabla `client_conditions`
--
ALTER TABLE `client_conditions`
  ADD CONSTRAINT `client_conditions_clinical_history_id_foreign` FOREIGN KEY (`clinical_history_id`) REFERENCES `clinical_histories` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `client_conditions_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE;

--
-- Filtros para la tabla `client_files`
--
ALTER TABLE `client_files`
  ADD CONSTRAINT `client_files_booking_id_foreign` FOREIGN KEY (`booking_id`) REFERENCES `bookings` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `client_files_clinical_history_id_foreign` FOREIGN KEY (`clinical_history_id`) REFERENCES `clinical_histories` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `client_files_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `client_files_uploaded_by_foreign` FOREIGN KEY (`uploaded_by`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Filtros para la tabla `clinical_backgrounds`
--
ALTER TABLE `clinical_backgrounds`
  ADD CONSTRAINT `clinical_backgrounds_clinical_history_id_foreign` FOREIGN KEY (`clinical_history_id`) REFERENCES `clinical_histories` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `clinical_backgrounds_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `clinical_backgrounds_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `clinical_backgrounds_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`) ON DELETE CASCADE;

--
-- Filtros para la tabla `clinical_diagnoses`
--
ALTER TABLE `clinical_diagnoses`
  ADD CONSTRAINT `clinical_diagnoses_clinical_evolution_id_foreign` FOREIGN KEY (`clinical_evolution_id`) REFERENCES `clinical_evolutions` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `clinical_diagnoses_clinical_history_id_foreign` FOREIGN KEY (`clinical_history_id`) REFERENCES `clinical_histories` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `clinical_diagnoses_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `clinical_diagnoses_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `clinical_diagnoses_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`) ON DELETE CASCADE;

--
-- Filtros para la tabla `clinical_evolutions`
--
ALTER TABLE `clinical_evolutions`
  ADD CONSTRAINT `clinical_evolutions_booking_id_foreign` FOREIGN KEY (`booking_id`) REFERENCES `bookings` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `clinical_evolutions_clinical_history_id_foreign` FOREIGN KEY (`clinical_history_id`) REFERENCES `clinical_histories` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `clinical_evolutions_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `clinical_evolutions_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `clinical_evolutions_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `clinical_evolutions_employee_id_foreign` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `clinical_evolutions_signed_by_foreign` FOREIGN KEY (`signed_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `clinical_evolutions_updated_by_foreign` FOREIGN KEY (`updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Filtros para la tabla `clinical_histories`
--
ALTER TABLE `clinical_histories`
  ADD CONSTRAINT `clinical_histories_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `clinical_histories_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `clinical_histories_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `clinical_histories_updated_by_foreign` FOREIGN KEY (`updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Filtros para la tabla `clinical_notes`
--
ALTER TABLE `clinical_notes`
  ADD CONSTRAINT `clinical_notes_booking_id_foreign` FOREIGN KEY (`booking_id`) REFERENCES `bookings` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `clinical_notes_clinical_history_id_foreign` FOREIGN KEY (`clinical_history_id`) REFERENCES `clinical_histories` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `clinical_notes_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `clinical_notes_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `clinical_notes_employee_id_foreign` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`) ON DELETE SET NULL;

--
-- Filtros para la tabla `clinical_orders`
--
ALTER TABLE `clinical_orders`
  ADD CONSTRAINT `clinical_orders_clinical_evolution_id_foreign` FOREIGN KEY (`clinical_evolution_id`) REFERENCES `clinical_evolutions` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `clinical_orders_clinical_history_id_foreign` FOREIGN KEY (`clinical_history_id`) REFERENCES `clinical_histories` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `clinical_orders_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `clinical_orders_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `clinical_orders_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `clinical_orders_employee_id_foreign` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `clinical_orders_signed_by_foreign` FOREIGN KEY (`signed_by`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Filtros para la tabla `companies`
--
ALTER TABLE `companies`
  ADD CONSTRAINT `companies_plan_id_foreign` FOREIGN KEY (`plan_id`) REFERENCES `plans` (`id`) ON DELETE SET NULL;

--
-- Filtros para la tabla `company_modules`
--
ALTER TABLE `company_modules`
  ADD CONSTRAINT `company_modules_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `company_modules_module_id_foreign` FOREIGN KEY (`module_id`) REFERENCES `modules` (`id`) ON DELETE CASCADE;

--
-- Filtros para la tabla `consent_forms`
--
ALTER TABLE `consent_forms`
  ADD CONSTRAINT `consent_forms_booking_id_foreign` FOREIGN KEY (`booking_id`) REFERENCES `bookings` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `consent_forms_clinical_history_id_foreign` FOREIGN KEY (`clinical_history_id`) REFERENCES `clinical_histories` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `consent_forms_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `consent_forms_employee_id_foreign` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`) ON DELETE SET NULL;

--
-- Filtros para la tabla `consent_templates`
--
ALTER TABLE `consent_templates`
  ADD CONSTRAINT `consent_templates_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `consent_templates_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Filtros para la tabla `coupons`
--
ALTER TABLE `coupons`
  ADD CONSTRAINT `coupons_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE;

--
-- Filtros para la tabla `customers`
--
ALTER TABLE `customers`
  ADD CONSTRAINT `customers_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `customers_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Filtros para la tabla `employees`
--
ALTER TABLE `employees`
  ADD CONSTRAINT `employees_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `employees_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `employees_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Filtros para la tabla `employee_services`
--
ALTER TABLE `employee_services`
  ADD CONSTRAINT `employee_services_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `employee_services_employee_id_foreign` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `employee_services_service_id_foreign` FOREIGN KEY (`service_id`) REFERENCES `services` (`id`) ON DELETE CASCADE;

--
-- Filtros para la tabla `gallery_items`
--
ALTER TABLE `gallery_items`
  ADD CONSTRAINT `gallery_items_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE;

--
-- Filtros para la tabla `model_has_permissions`
--
ALTER TABLE `model_has_permissions`
  ADD CONSTRAINT `model_has_permissions_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE;

--
-- Filtros para la tabla `model_has_roles`
--
ALTER TABLE `model_has_roles`
  ADD CONSTRAINT `model_has_roles_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE;

--
-- Filtros para la tabla `plan_modules`
--
ALTER TABLE `plan_modules`
  ADD CONSTRAINT `plan_modules_module_id_foreign` FOREIGN KEY (`module_id`) REFERENCES `modules` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `plan_modules_plan_id_foreign` FOREIGN KEY (`plan_id`) REFERENCES `plans` (`id`) ON DELETE CASCADE;

--
-- Filtros para la tabla `prescriptions`
--
ALTER TABLE `prescriptions`
  ADD CONSTRAINT `prescriptions_clinical_evolution_id_foreign` FOREIGN KEY (`clinical_evolution_id`) REFERENCES `clinical_evolutions` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `prescriptions_clinical_history_id_foreign` FOREIGN KEY (`clinical_history_id`) REFERENCES `clinical_histories` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `prescriptions_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `prescriptions_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `prescriptions_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `prescriptions_employee_id_foreign` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `prescriptions_signed_by_foreign` FOREIGN KEY (`signed_by`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Filtros para la tabla `prescription_items`
--
ALTER TABLE `prescription_items`
  ADD CONSTRAINT `prescription_items_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `prescription_items_prescription_id_foreign` FOREIGN KEY (`prescription_id`) REFERENCES `prescriptions` (`id`) ON DELETE CASCADE;

--
-- Filtros para la tabla `promotions`
--
ALTER TABLE `promotions`
  ADD CONSTRAINT `promotions_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE;

--
-- Filtros para la tabla `role_has_permissions`
--
ALTER TABLE `role_has_permissions`
  ADD CONSTRAINT `role_has_permissions_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `role_has_permissions_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE;

--
-- Filtros para la tabla `schedules`
--
ALTER TABLE `schedules`
  ADD CONSTRAINT `schedules_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `schedules_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `schedules_employee_id_foreign` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`) ON DELETE CASCADE;

--
-- Filtros para la tabla `schedule_blocks`
--
ALTER TABLE `schedule_blocks`
  ADD CONSTRAINT `schedule_blocks_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `schedule_blocks_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `schedule_blocks_employee_id_foreign` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`) ON DELETE CASCADE;

--
-- Filtros para la tabla `services`
--
ALTER TABLE `services`
  ADD CONSTRAINT `services_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `services_service_category_id_foreign` FOREIGN KEY (`service_category_id`) REFERENCES `service_categories` (`id`) ON DELETE SET NULL;

--
-- Filtros para la tabla `service_categories`
--
ALTER TABLE `service_categories`
  ADD CONSTRAINT `service_categories_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE;

--
-- Filtros para la tabla `subscriptions`
--
ALTER TABLE `subscriptions`
  ADD CONSTRAINT `subscriptions_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `subscriptions_plan_id_foreign` FOREIGN KEY (`plan_id`) REFERENCES `plans` (`id`);

--
-- Filtros para la tabla `subscription_payments`
--
ALTER TABLE `subscription_payments`
  ADD CONSTRAINT `subscription_payments_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `subscription_payments_subscription_id_foreign` FOREIGN KEY (`subscription_id`) REFERENCES `subscriptions` (`id`) ON DELETE CASCADE;

--
-- Filtros para la tabla `treatment_records`
--
ALTER TABLE `treatment_records`
  ADD CONSTRAINT `treatment_records_booking_id_foreign` FOREIGN KEY (`booking_id`) REFERENCES `bookings` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `treatment_records_clinical_history_id_foreign` FOREIGN KEY (`clinical_history_id`) REFERENCES `clinical_histories` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `treatment_records_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `treatment_records_employee_id_foreign` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `treatment_records_service_id_foreign` FOREIGN KEY (`service_id`) REFERENCES `services` (`id`) ON DELETE SET NULL;
COMMIT;

