--
-- Host: localhost    Database: noss2142_cdr
-- ------------------------------------------------------


--
-- Table structure for table `clientes`
--

CREATE TABLE `clientes` (
  `idcliente` int(11) NOT NULL AUTO_INCREMENT,
  `nome` varchar(50) NOT NULL,
  `email` varchar(100) NOT NULL,
  `celular` varchar(11) NOT NULL,
  `data_cadastro` date NOT NULL,
  `aceita_receber_mensagen_whatsapp` char(1) DEFAULT NULL,
  `idempresa` int(11) DEFAULT NULL,
  PRIMARY KEY (`idcliente`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

--
-- Dumping data for table `clientes`
--

INSERT INTO `clientes` (`idcliente`, `nome`, `email`, `celular`, `data_cadastro`, `aceita_receber_mensagen_whatsapp`, `idempresa`) VALUES (1,'felipe','felipe@controllinformatica.com.br','35987037651','2025-09-05','T',1);

--
-- Table structure for table `configuracao`
--

CREATE TABLE `configuracao` (
  `idconfig` int(11) NOT NULL AUTO_INCREMENT,
  `permitir_eventos_dias` char(1) DEFAULT 'S',
  `idempresa` int(11) DEFAULT NULL,
  `idtoken` varchar(100) DEFAULT NULL,
  `msg_dias` int(11) DEFAULT NULL,
  `logo` text DEFAULT NULL,
  `contato` varchar(30) DEFAULT NULL,
  PRIMARY KEY (`idconfig`),
  KEY `fk_configuracao_1` (`idempresa`),
  CONSTRAINT `fk_configuracao_1` FOREIGN KEY (`idempresa`) REFERENCES `system_unit` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

--
-- Dumping data for table `configuracao`
--

INSERT INTO `configuracao` (`idconfig`, `permitir_eventos_dias`, `idempresa`, `idtoken`, `msg_dias`, `logo`, `contato`) VALUES (1,'N',1,'felipe',1,'app/output/logo/1/68cb3d187e03e_imagem_do_whatsapp_de_2025_09_17_as_19.57.05_7b7332fd.jpg','35987037651');

--
-- Table structure for table `forma_pagto`
--

CREATE TABLE `forma_pagto` (
  `idpagto` int(11) NOT NULL AUTO_INCREMENT,
  `nome` varchar(50) NOT NULL,
  PRIMARY KEY (`idpagto`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

--
-- Dumping data for table `forma_pagto`
--

INSERT INTO `forma_pagto` (`idpagto`, `nome`) VALUES (1,'Dinheiro'),(2,'Cartão'),(3,'Cheque'),(4,'Pix'),(5,'Permuta');

--
-- Table structure for table `reserva`
--

CREATE TABLE `reserva` (
  `idreserva` int(11) NOT NULL AUTO_INCREMENT,
  `idstatus` int(11) DEFAULT NULL,
  `forma_pagto_id` int(11) DEFAULT NULL,
  `clientes_id` int(11) DEFAULT NULL,
  `data_reserva` datetime DEFAULT NULL,
  `qtd_pessoas` int(11) DEFAULT NULL,
  `comprovante` varchar(200) DEFAULT NULL,
  `obs` text DEFAULT NULL,
  `data_cadastro` datetime DEFAULT NULL,
  `valor` double DEFAULT NULL,
  `idempresa` int(11) DEFAULT NULL,
  `hora_reserva` time DEFAULT NULL,
  `data_reserva_final` datetime DEFAULT NULL,
  PRIMARY KEY (`idreserva`),
  KEY `fk_reserva_2` (`idstatus`),
  KEY `fk_reserva_3` (`forma_pagto_id`),
  KEY `fk_reserva_4` (`idempresa`),
  KEY `fk_reserva_clientes_id` (`clientes_id`),
  CONSTRAINT `fk_reserva_2` FOREIGN KEY (`idstatus`) REFERENCES `status` (`idstatus`),
  CONSTRAINT `fk_reserva_3` FOREIGN KEY (`forma_pagto_id`) REFERENCES `forma_pagto` (`idpagto`),
  CONSTRAINT `fk_reserva_4` FOREIGN KEY (`idempresa`) REFERENCES `system_unit` (`id`),
  CONSTRAINT `fk_reserva_clientes_id` FOREIGN KEY (`clientes_id`) REFERENCES `clientes` (`idcliente`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

--
-- Dumping data for table `reserva`
--

INSERT INTO `reserva` (`idreserva`, `idstatus`, `forma_pagto_id`, `clientes_id`, `data_reserva`, `qtd_pessoas`, `comprovante`, `obs`, `data_cadastro`, `valor`, `idempresa`, `hora_reserva`, `data_reserva_final`) VALUES (1,4,1,1,'2025-09-16 14:20:00',1,NULL,'teste','2025-09-17 14:35:00',1,1,'15:30:00','2025-09-16 09:00:00'),(2,3,1,1,'2025-09-17 00:00:00',1,NULL,NULL,'2025-09-17 14:56:00',1.1,1,'14:56:00',NULL),(3,3,1,1,'2025-09-18 00:00:00',1,NULL,NULL,'2025-09-17 14:57:00',0.12,1,'14:57:00',NULL),(4,4,1,1,'2025-09-17 00:00:00',1,NULL,NULL,'2025-09-17 14:58:00',50,1,'14:58:00',NULL),(5,4,1,1,'2025-09-18 16:00:00',1,NULL,NULL,'2025-09-17 16:00:00',50,1,NULL,'2025-09-18 22:05:00'),(6,4,1,1,'2025-09-19 15:15:00',1,NULL,NULL,'2025-09-17 19:17:00',50,1,NULL,'2025-09-19 22:00:00');

--
-- Table structure for table `status`
--

CREATE TABLE `status` (
  `idstatus` int(11) NOT NULL AUTO_INCREMENT,
  `nome` varchar(30) NOT NULL,
  `cor` varchar(10) NOT NULL,
  PRIMARY KEY (`idstatus`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

--
-- Dumping data for table `status`
--

INSERT INTO `status` (`idstatus`, `nome`, `cor`) VALUES (1,'Confirmado','#2b7527'),(2,'Reservado','#2b5c94'),(3,'Cancelado','#a11a20'),(4,'Realizado','#6b6b6b');

--
-- Table structure for table `system_document`
--

CREATE TABLE `system_document` (
  `id` int(11) NOT NULL,
  `category_id` int(11) NOT NULL,
  `system_user_id` int(11) DEFAULT NULL,
  `title` text NOT NULL,
  `description` text DEFAULT NULL,
  `submission_date` date DEFAULT NULL,
  `archive_date` date DEFAULT NULL,
  `filename` text DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_system_document_2` (`category_id`),
  KEY `fk_system_document_1` (`system_user_id`),
  CONSTRAINT `fk_system_document_1` FOREIGN KEY (`system_user_id`) REFERENCES `system_users` (`id`),
  CONSTRAINT `fk_system_document_2` FOREIGN KEY (`category_id`) REFERENCES `system_document_category` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

--
-- Dumping data for table `system_document`
--


--
-- Table structure for table `system_document_category`
--

CREATE TABLE `system_document_category` (
  `id` int(11) NOT NULL,
  `name` text NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

--
-- Dumping data for table `system_document_category`
--


--
-- Table structure for table `system_document_group`
--

CREATE TABLE `system_document_group` (
  `id` int(11) NOT NULL,
  `document_id` int(11) NOT NULL,
  `system_group_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_system_document_group_2` (`document_id`),
  KEY `fk_system_document_group_1` (`system_group_id`),
  CONSTRAINT `fk_system_document_group_1` FOREIGN KEY (`system_group_id`) REFERENCES `system_group` (`id`),
  CONSTRAINT `fk_system_document_group_2` FOREIGN KEY (`document_id`) REFERENCES `system_document` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

--
-- Dumping data for table `system_document_group`
--


--
-- Table structure for table `system_document_user`
--

CREATE TABLE `system_document_user` (
  `id` int(11) NOT NULL,
  `document_id` int(11) NOT NULL,
  `system_user_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_system_document_user_2` (`document_id`),
  KEY `fk_system_document_user_1` (`system_user_id`),
  CONSTRAINT `fk_system_document_user_1` FOREIGN KEY (`system_user_id`) REFERENCES `system_users` (`id`),
  CONSTRAINT `fk_system_document_user_2` FOREIGN KEY (`document_id`) REFERENCES `system_document` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

--
-- Dumping data for table `system_document_user`
--


--
-- Table structure for table `system_group`
--

CREATE TABLE `system_group` (
  `id` int(11) NOT NULL,
  `name` text NOT NULL,
  `uuid` varchar(36) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

--
-- Dumping data for table `system_group`
--

INSERT INTO `system_group` (`id`, `name`, `uuid`) VALUES (1,'Admin',NULL),(2,'Standard',NULL),(3,'Dashboard','54cdfa34-b3e9-4e8d-bfc4-aa83cf30d1b0'),(4,'Reservas','95e76f9b-752d-435b-86e2-41e0c468c9f0'),(5,'Clientes','79c8148c-c946-482d-9f8e-a22b4ddb06be'),(6,'Calendário ','9f5b6218-7d64-42ff-b422-240801621f4f'),(7,'Configuração','a9ce4b65-b81c-4a5e-aa7b-c09d1770bd02');

--
-- Table structure for table `system_group_program`
--

CREATE TABLE `system_group_program` (
  `id` int(11) NOT NULL,
  `system_group_id` int(11) NOT NULL,
  `system_program_id` int(11) NOT NULL,
  `actions` text DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_system_group_program_1` (`system_program_id`),
  KEY `fk_system_group_program_2` (`system_group_id`),
  CONSTRAINT `fk_system_group_program_1` FOREIGN KEY (`system_program_id`) REFERENCES `system_program` (`id`),
  CONSTRAINT `fk_system_group_program_2` FOREIGN KEY (`system_group_id`) REFERENCES `system_group` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

--
-- Dumping data for table `system_group_program`
--

INSERT INTO `system_group_program` (`id`, `system_group_id`, `system_program_id`, `actions`) VALUES (1,1,1,NULL),(2,1,2,NULL),(3,1,3,NULL),(4,1,4,NULL),(5,1,5,NULL),(6,1,6,NULL),(7,1,8,NULL),(8,1,9,NULL),(9,1,11,NULL),(10,1,14,NULL),(11,1,15,NULL),(12,2,10,NULL),(13,2,12,NULL),(14,2,13,NULL),(15,2,16,NULL),(16,2,17,NULL),(17,2,18,NULL),(18,2,19,NULL),(19,2,20,NULL),(20,1,21,NULL),(21,2,22,NULL),(22,2,23,NULL),(23,2,24,NULL),(24,2,25,NULL),(25,1,26,NULL),(26,1,27,NULL),(27,1,28,NULL),(28,1,29,NULL),(29,2,30,NULL),(30,1,31,NULL),(31,1,32,NULL),(32,1,33,NULL),(33,1,34,NULL),(34,1,35,NULL),(35,1,36,NULL),(36,1,37,NULL),(37,1,38,NULL),(38,1,39,NULL),(39,1,40,NULL),(40,1,41,NULL),(41,1,42,NULL),(42,3,43,NULL),(43,3,44,NULL),(44,3,45,NULL),(45,3,46,NULL),(46,3,47,NULL),(47,3,48,NULL),(48,3,49,NULL),(49,3,50,NULL),(50,3,51,NULL),(51,3,52,NULL),(52,4,44,NULL),(53,5,45,NULL),(54,6,48,NULL),(55,6,49,NULL),(56,7,50,NULL);

--
-- Table structure for table `system_message`
--

CREATE TABLE `system_message` (
  `id` int(11) NOT NULL,
  `system_user_id` int(11) NOT NULL,
  `system_user_to_id` int(11) NOT NULL,
  `subject` text NOT NULL,
  `message` text DEFAULT NULL,
  `dt_message` datetime DEFAULT NULL,
  `checked` char(1) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_system_message_1` (`system_user_id`),
  KEY `fk_system_message_2` (`system_user_to_id`),
  CONSTRAINT `fk_system_message_1` FOREIGN KEY (`system_user_id`) REFERENCES `system_users` (`id`),
  CONSTRAINT `fk_system_message_2` FOREIGN KEY (`system_user_to_id`) REFERENCES `system_users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

--
-- Dumping data for table `system_message`
--


--
-- Table structure for table `system_notification`
--

CREATE TABLE `system_notification` (
  `id` int(11) NOT NULL,
  `system_user_id` int(11) NOT NULL,
  `system_user_to_id` int(11) NOT NULL,
  `subject` text DEFAULT NULL,
  `message` text DEFAULT NULL,
  `dt_message` datetime DEFAULT NULL,
  `action_url` text DEFAULT NULL,
  `action_label` text DEFAULT NULL,
  `icon` text DEFAULT NULL,
  `checked` char(1) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_system_notification_1` (`system_user_id`),
  KEY `fk_system_notification_2` (`system_user_to_id`),
  CONSTRAINT `fk_system_notification_1` FOREIGN KEY (`system_user_id`) REFERENCES `system_users` (`id`),
  CONSTRAINT `fk_system_notification_2` FOREIGN KEY (`system_user_to_id`) REFERENCES `system_users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

--
-- Dumping data for table `system_notification`
--


--
-- Table structure for table `system_preference`
--

CREATE TABLE `system_preference` (
  `id` varchar(255) NOT NULL,
  `preference` text DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

--
-- Dumping data for table `system_preference`
--


--
-- Table structure for table `system_program`
--

CREATE TABLE `system_program` (
  `id` int(11) NOT NULL,
  `name` text NOT NULL,
  `controller` text NOT NULL,
  `actions` text DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

--
-- Dumping data for table `system_program`
--

INSERT INTO `system_program` (`id`, `name`, `controller`, `actions`) VALUES (1,'System Group Form','SystemGroupForm',NULL),(2,'System Group List','SystemGroupList',NULL),(3,'System Program Form','SystemProgramForm',NULL),(4,'System Program List','SystemProgramList',NULL),(5,'System User Form','SystemUserForm',NULL),(6,'System User List','SystemUserList',NULL),(7,'Common Page','CommonPage',NULL),(8,'System PHP Info','SystemPHPInfoView',NULL),(9,'System ChangeLog View','SystemChangeLogView',NULL),(10,'Welcome View','WelcomeView',NULL),(11,'System Sql Log','SystemSqlLogList',NULL),(12,'System Profile View','SystemProfileView',NULL),(13,'System Profile Form','SystemProfileForm',NULL),(14,'System SQL Panel','SystemSQLPanel',NULL),(15,'System Access Log','SystemAccessLogList',NULL),(16,'System Message Form','SystemMessageForm',NULL),(17,'System Message List','SystemMessageList',NULL),(18,'System Message Form View','SystemMessageFormView',NULL),(19,'System Notification List','SystemNotificationList',NULL),(20,'System Notification Form View','SystemNotificationFormView',NULL),(21,'System Document Category List','SystemDocumentCategoryFormList',NULL),(22,'System Document Form','SystemDocumentForm',NULL),(23,'System Document Upload Form','SystemDocumentUploadForm',NULL),(24,'System Document List','SystemDocumentList',NULL),(25,'System Shared Document List','SystemSharedDocumentList',NULL),(26,'System Unit Form','SystemUnitForm',NULL),(27,'System Unit List','SystemUnitList',NULL),(28,'System Access stats','SystemAccessLogStats',NULL),(29,'System Preference form','SystemPreferenceForm',NULL),(30,'System Support form','SystemSupportForm',NULL),(31,'System PHP Error','SystemPHPErrorLogView',NULL),(32,'System Database Browser','SystemDatabaseExplorer',NULL),(33,'System Table List','SystemTableList',NULL),(34,'System Data Browser','SystemDataBrowser',NULL),(35,'System Menu Editor','SystemMenuEditor',NULL),(36,'System Request Log','SystemRequestLogList',NULL),(37,'System Request Log View','SystemRequestLogView',NULL),(38,'System Administration Dashboard','SystemAdministrationDashboard',NULL),(39,'System Log Dashboard','SystemLogDashboard',NULL),(40,'System Session dump','SystemSessionDumpView',NULL),(41,'Files diff','SystemFilesDiff',NULL),(42,'System Information','SystemInformationView',NULL),(43,'Dashboard','Dashboard',NULL),(44,'Reservas','ReservaList',NULL),(45,'Clientes','ClientesList',NULL),(46,'Configurações','ConfiguracaoForm',NULL),(47,'Cadastro de Reserva','ReservaForm',NULL),(48,'Calendário(Form)','ReservaCalendarForm',NULL),(49,'Calendário(View)','ReservaCalendarFormView',NULL),(50,'Configuração','ConfiguracaoHeaderList',NULL),(51,'Cadastro de Clientes','ClientesForm',NULL),(52,'Reserva document','ReservaDocument',NULL);

--
-- Table structure for table `system_unit`
--

CREATE TABLE `system_unit` (
  `id` int(11) NOT NULL,
  `name` text NOT NULL,
  `connection_name` text DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

--
-- Dumping data for table `system_unit`
--

INSERT INTO `system_unit` (`id`, `name`, `connection_name`) VALUES (1,'Matriz','matriz'),(2,'Filial',NULL);

--
-- Table structure for table `system_user_group`
--

CREATE TABLE `system_user_group` (
  `id` int(11) NOT NULL,
  `system_user_id` int(11) NOT NULL,
  `system_group_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_system_user_group_1` (`system_group_id`),
  KEY `fk_system_user_group_2` (`system_user_id`),
  CONSTRAINT `fk_system_user_group_1` FOREIGN KEY (`system_group_id`) REFERENCES `system_group` (`id`),
  CONSTRAINT `fk_system_user_group_2` FOREIGN KEY (`system_user_id`) REFERENCES `system_users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

--
-- Dumping data for table `system_user_group`
--

INSERT INTO `system_user_group` (`id`, `system_user_id`, `system_group_id`) VALUES (3,1,1),(4,1,2),(5,1,3),(6,2,2),(7,2,3);

--
-- Table structure for table `system_user_program`
--

CREATE TABLE `system_user_program` (
  `id` int(11) NOT NULL,
  `system_user_id` int(11) NOT NULL,
  `system_program_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_system_user_program_1` (`system_program_id`),
  KEY `fk_system_user_program_2` (`system_user_id`),
  CONSTRAINT `fk_system_user_program_1` FOREIGN KEY (`system_program_id`) REFERENCES `system_program` (`id`),
  CONSTRAINT `fk_system_user_program_2` FOREIGN KEY (`system_user_id`) REFERENCES `system_users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

--
-- Dumping data for table `system_user_program`
--

INSERT INTO `system_user_program` (`id`, `system_user_id`, `system_program_id`) VALUES (1,2,7);

--
-- Table structure for table `system_user_unit`
--

CREATE TABLE `system_user_unit` (
  `id` int(11) NOT NULL,
  `system_user_id` int(11) NOT NULL,
  `system_unit_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_system_user_unit_1` (`system_user_id`),
  KEY `fk_system_user_unit_2` (`system_unit_id`),
  CONSTRAINT `fk_system_user_unit_1` FOREIGN KEY (`system_user_id`) REFERENCES `system_users` (`id`),
  CONSTRAINT `fk_system_user_unit_2` FOREIGN KEY (`system_unit_id`) REFERENCES `system_unit` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

--
-- Dumping data for table `system_user_unit`
--

INSERT INTO `system_user_unit` (`id`, `system_user_id`, `system_unit_id`) VALUES (1,1,1),(2,1,2),(3,2,2);

--
-- Dumping events for database 'noss2142_cdr'
--

--
-- Dumping routines for database 'noss2142_cdr'
--


