-- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Tempo de geração: 06/07/2026 às 17:07
-- Versão do servidor: 10.4.32-MariaDB
-- Versão do PHP: 8.2.12

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Banco de dados: `suporte`
--

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

--
-- Estrutura para tabela `approvals`
--

CREATE TABLE `approvals` (
  `id` int(11) NOT NULL,
  `ticket_id` int(11) DEFAULT NULL,
  `customer_id` int(11) DEFAULT NULL,
  `type` varchar(80) DEFAULT 'Orçamento',
  `description` text DEFAULT NULL,
  `amount` decimal(10,2) DEFAULT 0.00,
  `status` enum('Pendente','Aprovado','Recusado') DEFAULT 'Pendente',
  `approved_at` datetime DEFAULT NULL,
  `signature_path` varchar(255) DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Estrutura para tabela `audit_logs`
--

CREATE TABLE `audit_logs` (
  `id` int(11) NOT NULL,
  `user_id` int(11) DEFAULT NULL,
  `action` varchar(200) DEFAULT NULL,
  `ip` varchar(60) DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Estrutura para tabela `contracts`
--

CREATE TABLE `contracts` (
  `id` int(11) NOT NULL,
  `customer_id` int(11) DEFAULT NULL,
  `number` varchar(80) DEFAULT NULL,
  `type` varchar(80) DEFAULT NULL,
  `description` text DEFAULT NULL,
  `start_date` date DEFAULT NULL,
  `end_date` date DEFAULT NULL,
  `value` decimal(10,2) DEFAULT 0.00,
  `status` varchar(40) DEFAULT 'Ativo',
  `created_at` datetime DEFAULT current_timestamp(),
  `franchise_bw` int(11) DEFAULT 0,
  `franchise_color` int(11) DEFAULT 0,
  `excess_bw_value` decimal(10,4) DEFAULT 0.0000,
  `excess_color_value` decimal(10,4) DEFAULT 0.0000,
  `billing_day` int(11) DEFAULT 10
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Despejando dados para a tabela `contracts`
--

INSERT INTO `contracts` (`id`, `customer_id`, `number`, `type`, `description`, `start_date`, `end_date`, `value`, `status`, `created_at`, `franchise_bw`, `franchise_color`, `excess_bw_value`, `excess_color_value`, `billing_day`) VALUES
(1, 1, 'CT-2026-000125', 'Locação', 'Contrato de impressoras multifuncionais', '2026-01-01', '2027-01-15', 450.00, 'Ativo', '2026-06-30 10:08:32', 0, 0, 0.0000, 0.0000, 10),
(2, 1, 'CT-2026-000125', 'Locação', 'Contrato de impressoras multifuncionais', '2026-01-01', '2027-01-15', 450.00, 'Ativo', '2026-06-30 10:08:54', 0, 0, 0.0000, 0.0000, 10),
(3, 1, 'CT-2026-000125', 'Locação', 'Contrato de impressoras multifuncionais', '2026-01-01', '2027-01-15', 450.00, 'Ativo', '2026-06-30 10:13:24', 0, 0, 0.0000, 0.0000, 10),
(4, 1, 'CT-2026-000125', 'Locação', 'Contrato de impressoras multifuncionais', '2026-01-01', '2027-01-15', 450.00, 'Ativo', '2026-06-30 10:46:04', 0, 0, 0.0000, 0.0000, 10);

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

--
-- Estrutura para tabela `customers`
--

CREATE TABLE `customers` (
  `id` int(11) NOT NULL,
  `name` varchar(160) DEFAULT NULL,
  `email` varchar(160) DEFAULT NULL,
  `phone` varchar(40) DEFAULT NULL,
  `document` varchar(40) DEFAULT NULL,
  `address` varchar(255) DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  `contact_name` varchar(160) DEFAULT NULL,
  `city` varchar(120) DEFAULT NULL,
  `state` varchar(40) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Despejando dados para a tabela `customers`
--

INSERT INTO `customers` (`id`, `name`, `email`, `phone`, `document`, `address`, `created_at`, `contact_name`, `city`, `state`) VALUES
(1, 'Empresa Exemplo Ltda', 'cliente@demo.com.br', '(00) 90000-0000', '00.000.000/0001-00', 'Endereço de demonstração', '2026-06-30 10:08:32', NULL, NULL, NULL);

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

--
-- Estrutura para tabela `equipment`
--

CREATE TABLE `equipment` (
  `id` int(11) NOT NULL,
  `customer_id` int(11) DEFAULT NULL,
  `type` varchar(80) DEFAULT NULL,
  `brand` varchar(80) DEFAULT NULL,
  `model` varchar(120) DEFAULT NULL,
  `serial` varchar(120) DEFAULT NULL,
  `asset_tag` varchar(120) DEFAULT NULL,
  `location` varchar(160) DEFAULT NULL,
  `notes` text DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  `code` varchar(50) DEFAULT NULL,
  `manufacturer` varchar(120) DEFAULT NULL,
  `serial_number` varchar(160) DEFAULT NULL,
  `department` varchar(120) DEFAULT NULL,
  `contract_id` int(11) DEFAULT NULL,
  `photo_path` varchar(255) DEFAULT NULL,
  `status` enum('ativo','inativo','manutencao','baixado') DEFAULT 'ativo',
  `counter_bw` int(11) DEFAULT 0,
  `counter_color` int(11) DEFAULT 0,
  `fuser_life` int(11) DEFAULT NULL,
  `drum_life` int(11) DEFAULT NULL,
  `photo` varchar(255) DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
  `ip_address` varchar(80) DEFAULT NULL,
  `mac_address` varchar(80) DEFAULT NULL,
  `hostname` varchar(120) DEFAULT NULL,
  `gateway` varchar(120) DEFAULT NULL,
  `subnet_mask` varchar(80) DEFAULT NULL,
  `firmware_version` varchar(120) DEFAULT NULL,
  `acquisition_date` date DEFAULT NULL,
  `expected_life_pages` int(11) DEFAULT NULL,
  `monthly_allowance_bw` int(11) DEFAULT NULL,
  `monthly_allowance_color` int(11) DEFAULT NULL,
  `monthly_contract_value` decimal(10,2) DEFAULT NULL,
  `responsible_technician` varchar(160) DEFAULT NULL,
  `next_preventive_at` date DEFAULT NULL,
  `installed_at` date DEFAULT NULL,
  `warranty_until` date DEFAULT NULL,
  `last_maintenance_at` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Despejando dados para a tabela `equipment`
--

INSERT INTO `equipment` (`id`, `customer_id`, `type`, `brand`, `model`, `serial`, `asset_tag`, `location`, `notes`, `created_at`, `code`, `manufacturer`, `serial_number`, `department`, `contract_id`, `photo_path`, `status`, `counter_bw`, `counter_color`, `fuser_life`, `drum_life`, `photo`, `updated_at`, `ip_address`, `mac_address`, `hostname`, `gateway`, `subnet_mask`, `firmware_version`, `acquisition_date`, `expected_life_pages`, `monthly_allowance_bw`, `monthly_allowance_color`, `monthly_contract_value`, `responsible_technician`, `next_preventive_at`, `installed_at`, `warranty_until`, `last_maintenance_at`) VALUES
(1, 1, 'Impressora', 'Brother', 'DCP-L5652DN', 'BR123456', 'EQ-001', 'Recepção', NULL, '2026-06-30 10:08:32', NULL, NULL, NULL, NULL, NULL, NULL, 'ativo', 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(2, 1, 'Impressora', 'HP', 'LaserJet Pro', 'HP98765', 'EQ-002', 'Financeiro', NULL, '2026-06-30 10:08:32', NULL, NULL, NULL, NULL, NULL, NULL, 'ativo', 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(3, 1, 'Impressora', 'Brother', 'DCP-L5652DN', 'BR123456', 'EQ-001', 'Recepção', NULL, '2026-06-30 10:08:54', NULL, NULL, NULL, NULL, NULL, NULL, 'ativo', 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(4, 1, 'Impressora', 'HP', 'LaserJet Pro', 'HP98765', 'EQ-002', 'Financeiro', NULL, '2026-06-30 10:08:54', NULL, NULL, NULL, NULL, NULL, NULL, 'ativo', 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(5, 1, 'Impressora', 'Brother', 'DCP-L5652DN', 'BR123456', 'EQ-001', 'Recepção', NULL, '2026-06-30 10:13:24', NULL, NULL, NULL, NULL, NULL, NULL, 'ativo', 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(6, 1, 'Impressora', 'HP', 'LaserJet Pro', 'HP98765', 'EQ-002', 'Financeiro', NULL, '2026-06-30 10:13:24', NULL, NULL, NULL, NULL, NULL, NULL, 'ativo', 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(7, 1, 'Impressora', 'Brother', 'DCP-L5652DN', 'BR123456', 'EQ-001', 'Recepção', NULL, '2026-06-30 10:46:04', NULL, NULL, NULL, NULL, NULL, NULL, 'ativo', 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(8, 1, 'Impressora', 'HP', 'LaserJet Pro', 'HP98765', 'EQ-002', 'Financeiro', NULL, '2026-06-30 10:46:04', NULL, NULL, NULL, NULL, NULL, NULL, 'ativo', 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(9, NULL, 'Impressora', NULL, 'IM C3000', NULL, 'SF-IMP-0001', 'Cliente Demonstração', 'Equipamento de demonstração', '2026-06-30 10:50:34', 'IMP-0001', 'Ricoh', 'DEMO-123456', 'Financeiro', NULL, NULL, 'ativo', 245851, 38942, 78, 62, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);

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

--
-- Estrutura para tabela `equipment_counter_history`
--

CREATE TABLE `equipment_counter_history` (
  `id` int(11) NOT NULL,
  `equipment_id` int(11) NOT NULL,
  `counter_bw` int(11) NOT NULL DEFAULT 0,
  `counter_color` int(11) NOT NULL DEFAULT 0,
  `reading_date` date NOT NULL,
  `notes` text DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Estrutura para tabela `equipment_operational_events`
--

CREATE TABLE `equipment_operational_events` (
  `id` int(11) NOT NULL,
  `equipment_id` int(11) NOT NULL,
  `event_type` varchar(80) NOT NULL,
  `title` varchar(180) NOT NULL,
  `description` text DEFAULT NULL,
  `event_date` datetime NOT NULL DEFAULT current_timestamp(),
  `user_name` varchar(160) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Estrutura para tabela `equipment_parts_history`
--

CREATE TABLE `equipment_parts_history` (
  `id` int(11) NOT NULL,
  `equipment_id` int(11) NOT NULL,
  `part_name` varchar(160) NOT NULL,
  `part_code` varchar(80) DEFAULT NULL,
  `quantity` int(11) NOT NULL DEFAULT 1,
  `technician_name` varchar(160) DEFAULT NULL,
  `cost` decimal(10,2) DEFAULT NULL,
  `notes` text DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Estrutura para tabela `equipment_photos`
--

CREATE TABLE `equipment_photos` (
  `id` int(11) NOT NULL,
  `equipment_id` int(11) NOT NULL,
  `file_path` varchar(255) NOT NULL,
  `caption` varchar(160) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Estrutura para tabela `invoices`
--

CREATE TABLE `invoices` (
  `id` int(11) NOT NULL,
  `customer_id` int(11) DEFAULT NULL,
  `contract_id` int(11) DEFAULT NULL,
  `description` varchar(220) DEFAULT NULL,
  `amount` decimal(10,2) NOT NULL DEFAULT 0.00,
  `due_date` date DEFAULT NULL,
  `paid_at` date DEFAULT NULL,
  `status` enum('Aberta','Paga','Vencida','Cancelada') DEFAULT 'Aberta',
  `payment_method` varchar(60) DEFAULT NULL,
  `pix_code` text DEFAULT NULL,
  `boleto_url` varchar(255) DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Despejando dados para a tabela `invoices`
--

INSERT INTO `invoices` (`id`, `customer_id`, `contract_id`, `description`, `amount`, `due_date`, `paid_at`, `status`, `payment_method`, `pix_code`, `boleto_url`, `created_at`) VALUES
(1, 1, 1, 'Mensalidade contrato demonstração', 450.00, '2026-07-10', NULL, 'Aberta', 'PIX', NULL, NULL, '2026-06-30 13:02:47');

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

--
-- Estrutura para tabela `knowledge_articles`
--

CREATE TABLE `knowledge_articles` (
  `id` int(11) NOT NULL,
  `title` varchar(200) DEFAULT NULL,
  `category` varchar(120) DEFAULT NULL,
  `content` text DEFAULT NULL,
  `published` tinyint(4) DEFAULT 1,
  `created_at` datetime DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Despejando dados para a tabela `knowledge_articles`
--

INSERT INTO `knowledge_articles` (`id`, `title`, `category`, `content`, `published`, `created_at`) VALUES
(1, 'Como abrir um chamado', 'Portal', 'Acesse Novo Chamado, descreva o problema e envie fotos quando necessário.', 1, '2026-06-30 10:08:32'),
(2, 'Como solicitar toner', 'Suprimentos', 'Abra um chamado na categoria Toner e informe o modelo do equipamento.', 1, '2026-06-30 10:08:32'),
(3, 'Como abrir um chamado', 'Portal', 'Acesse Novo Chamado, descreva o problema e envie fotos quando necessário.', 1, '2026-06-30 10:08:54'),
(4, 'Como solicitar toner', 'Suprimentos', 'Abra um chamado na categoria Toner e informe o modelo do equipamento.', 1, '2026-06-30 10:08:54'),
(5, 'Como abrir um chamado', 'Portal', 'Acesse Novo Chamado, descreva o problema e envie fotos quando necessário.', 1, '2026-06-30 10:13:24'),
(6, 'Como solicitar toner', 'Suprimentos', 'Abra um chamado na categoria Toner e informe o modelo do equipamento.', 1, '2026-06-30 10:13:24'),
(7, 'Como abrir um chamado', 'Portal', 'Acesse Novo Chamado, descreva o problema e envie fotos quando necessário.', 1, '2026-06-30 10:46:04'),
(8, 'Como solicitar toner', 'Suprimentos', 'Abra um chamado na categoria Toner e informe o modelo do equipamento.', 1, '2026-06-30 10:46:04');

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

--
-- Estrutura para tabela `maintenance_history`
--

CREATE TABLE `maintenance_history` (
  `id` int(11) NOT NULL,
  `equipment_id` int(11) DEFAULT NULL,
  `ticket_id` int(11) DEFAULT NULL,
  `description` text DEFAULT NULL,
  `technician_name` varchar(160) DEFAULT NULL,
  `cost` decimal(10,2) DEFAULT NULL,
  `technician_id` int(11) DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Estrutura para tabela `message_templates`
--

CREATE TABLE `message_templates` (
  `id` int(11) NOT NULL,
  `name` varchar(120) NOT NULL,
  `channel` varchar(40) DEFAULT 'WhatsApp',
  `subject` varchar(180) DEFAULT NULL,
  `body` text DEFAULT NULL,
  `active` tinyint(4) DEFAULT 1,
  `created_at` datetime DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Despejando dados para a tabela `message_templates`
--

INSERT INTO `message_templates` (`id`, `name`, `channel`, `subject`, `body`, `active`, `created_at`) VALUES
(1, 'Chamado aberto', 'WhatsApp', 'Chamado recebido', 'Olá, recebemos seu chamado #{protocol}. Nossa equipe irá acompanhar.', 1, '2026-06-30 13:02:47'),
(2, 'Técnico a caminho', 'WhatsApp', 'Técnico deslocado', 'O técnico foi acionado e está a caminho para o atendimento.', 1, '2026-06-30 13:02:47');

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

--
-- Estrutura para tabela `settings`
--

CREATE TABLE `settings` (
  `key` varchar(120) NOT NULL,
  `value` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Despejando dados para a tabela `settings`
--

INSERT INTO `settings` (`key`, `value`) VALUES
('company_name', 'Superfax Soluções'),
('default_sla_hours', '8'),
('enterprise_version', 'FULL_V1'),
('pdf_footer', 'Documento gerado pelo Superfax HelpDesk Enterprise'),
('pwa_enabled', '1'),
('smtp_enabled', '0'),
('smtp_host', ''),
('smtp_pass', ''),
('smtp_user', ''),
('whatsapp_ai_business_hours', '08:00-18:00'),
('whatsapp_ai_enabled', '0'),
('whatsapp_api_key', ''),
('whatsapp_api_url', 'http://localhost:8080'),
('whatsapp_auto_ticket', '1'),
('whatsapp_company_name', 'SUPERFAX SOLUÇÕES'),
('whatsapp_default_technician', ''),
('whatsapp_enabled', '0'),
('whatsapp_human_after', '3'),
('whatsapp_instance', 'SUPERFAX'),
('whatsapp_phone_id', ''),
('whatsapp_token', ''),
('whatsapp_webhook_enabled', '0'),
('whatsapp_webhook_secret', 'superfax-webhook');

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

--
-- Estrutura para tabela `stock_items`
--

CREATE TABLE `stock_items` (
  `id` int(11) NOT NULL,
  `sku` varchar(80) DEFAULT NULL,
  `name` varchar(180) NOT NULL,
  `category` varchar(80) DEFAULT 'Peça',
  `compatible_models` text DEFAULT NULL,
  `quantity` int(11) NOT NULL DEFAULT 0,
  `min_quantity` int(11) NOT NULL DEFAULT 0,
  `unit_cost` decimal(10,2) DEFAULT 0.00,
  `location` varchar(120) DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Despejando dados para a tabela `stock_items`
--

INSERT INTO `stock_items` (`id`, `sku`, `name`, `category`, `compatible_models`, `quantity`, `min_quantity`, `unit_cost`, `location`, `created_at`) VALUES
(1, 'TN-DEMO-001', 'Toner Compatível Demonstração', 'Toner', 'Brother, HP, Ricoh', 10, 3, 85.00, 'Almoxarifado', '2026-06-30 13:02:46'),
(2, 'FUS-DEMO-001', 'Fusor Demonstração', 'Peça', 'Multifuncionais laser', 2, 1, 450.00, 'Almoxarifado', '2026-06-30 13:02:46');

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

--
-- Estrutura para tabela `stock_movements`
--

CREATE TABLE `stock_movements` (
  `id` int(11) NOT NULL,
  `item_id` int(11) DEFAULT NULL,
  `type` enum('entrada','saida','ajuste') DEFAULT 'entrada',
  `quantity` int(11) NOT NULL DEFAULT 1,
  `ticket_id` int(11) DEFAULT NULL,
  `equipment_id` int(11) DEFAULT NULL,
  `technician_id` int(11) DEFAULT NULL,
  `notes` text DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Estrutura para tabela `technician_visits`
--

CREATE TABLE `technician_visits` (
  `id` int(11) NOT NULL,
  `ticket_id` int(11) DEFAULT NULL,
  `technician_id` int(11) DEFAULT NULL,
  `equipment_id` int(11) DEFAULT NULL,
  `checkin_at` datetime DEFAULT NULL,
  `checkout_at` datetime DEFAULT NULL,
  `latitude` varchar(60) DEFAULT NULL,
  `longitude` varchar(60) DEFAULT NULL,
  `checklist` text DEFAULT NULL,
  `signature_path` varchar(255) DEFAULT NULL,
  `notes` text DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Estrutura para tabela `tickets`
--

CREATE TABLE `tickets` (
  `id` int(11) NOT NULL,
  `protocol` varchar(30) DEFAULT NULL,
  `customer_id` int(11) DEFAULT NULL,
  `equipment_id` int(11) DEFAULT NULL,
  `user_id` int(11) DEFAULT NULL,
  `technician_id` int(11) DEFAULT NULL,
  `title` varchar(200) DEFAULT NULL,
  `description` text DEFAULT NULL,
  `channel` varchar(40) DEFAULT 'Portal',
  `category` varchar(120) DEFAULT NULL,
  `priority` enum('Baixa','Média','Alta','Urgente') DEFAULT 'Média',
  `status` enum('Aberto','Em atendimento','Aguardando cliente','Concluído','Cancelado') DEFAULT 'Aberto',
  `sla_due` datetime DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT NULL,
  `closed_at` datetime DEFAULT NULL,
  `approval_status` varchar(40) DEFAULT NULL,
  `source_message_id` varchar(120) DEFAULT NULL,
  `customer_signature` varchar(255) DEFAULT NULL,
  `downtime_minutes` int(11) DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Despejando dados para a tabela `tickets`
--

INSERT INTO `tickets` (`id`, `protocol`, `customer_id`, `equipment_id`, `user_id`, `technician_id`, `title`, `description`, `channel`, `category`, `priority`, `status`, `sla_due`, `created_at`, `updated_at`, `closed_at`, `approval_status`, `source_message_id`, `customer_signature`, `downtime_minutes`) VALUES
(1, '2487', 1, NULL, 3, NULL, 'Impressora não liga', 'Cliente informa que a impressora da recepção não liga.', 'WhatsApp', NULL, 'Alta', 'Aberto', '2026-06-30 14:08:32', '2026-06-30 10:08:32', NULL, NULL, NULL, NULL, NULL, 0),
(2, '2481', 1, NULL, 3, NULL, 'Equipamento com falhas', 'Falhas recorrentes ao imprimir.', 'Portal', NULL, 'Média', 'Em atendimento', '2026-06-30 18:08:32', '2026-06-30 10:08:32', NULL, NULL, NULL, NULL, NULL, 0),
(3, '2487', 1, NULL, 3, NULL, 'Impressora não liga', 'Cliente informa que a impressora da recepção não liga.', 'WhatsApp', NULL, 'Alta', 'Aberto', '2026-06-30 14:08:54', '2026-06-30 10:08:54', NULL, NULL, NULL, NULL, NULL, 0),
(4, '2481', 1, NULL, 3, NULL, 'Equipamento com falhas', 'Falhas recorrentes ao imprimir.', 'Portal', NULL, 'Média', 'Em atendimento', '2026-06-30 18:08:54', '2026-06-30 10:08:54', NULL, NULL, NULL, NULL, NULL, 0),
(5, '2487', 1, NULL, 3, NULL, 'Impressora não liga', 'Cliente informa que a impressora da recepção não liga.', 'WhatsApp', NULL, 'Alta', 'Concluído', '2026-06-30 14:13:24', '2026-06-30 10:13:24', '2026-07-01 16:28:34', '2026-07-01 16:28:34', NULL, NULL, NULL, 0),
(6, '2481', 1, NULL, 3, NULL, 'Equipamento com falhas', 'Falhas recorrentes ao imprimir.', 'Portal', NULL, 'Média', 'Em atendimento', '2026-06-30 18:13:24', '2026-06-30 10:13:24', NULL, NULL, NULL, NULL, NULL, 0),
(7, '2487', 1, NULL, 3, NULL, 'Impressora não liga', 'Cliente informa que a impressora da recepção não liga.', 'WhatsApp', 'Suporte Técnico', 'Alta', 'Concluído', '2026-06-30 14:46:04', '2026-06-30 10:46:04', '2026-06-30 13:41:42', '2026-06-30 13:41:42', NULL, NULL, NULL, 0),
(8, '2481', 1, NULL, 3, NULL, 'Equipamento com falhas', 'Falhas recorrentes ao imprimir.', 'Portal', 'Manutenção', 'Média', 'Em atendimento', '2026-06-30 18:46:04', '2026-06-30 10:46:04', NULL, NULL, NULL, NULL, NULL, 0),
(9, '4346', 1, NULL, 1, NULL, 'teste', 'testeteste', 'Portal', NULL, 'Urgente', 'Concluído', '2026-06-30 15:12:47', '2026-06-30 13:12:47', '2026-06-30 13:17:17', '2026-06-30 13:17:17', NULL, NULL, NULL, 0),
(10, '6334', 1, NULL, 10, NULL, 'teste', 'teste', 'Portal', NULL, 'Média', 'Aberto', '2026-07-06 23:24:13', '2026-07-06 11:24:13', NULL, NULL, NULL, NULL, NULL, 0);

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

--
-- Estrutura para tabela `ticket_attachments`
--

CREATE TABLE `ticket_attachments` (
  `id` int(11) NOT NULL,
  `ticket_id` int(11) NOT NULL,
  `user_id` int(11) DEFAULT NULL,
  `filename` varchar(255) DEFAULT NULL,
  `original_name` varchar(255) DEFAULT NULL,
  `mime` varchar(120) DEFAULT NULL,
  `size_bytes` int(11) DEFAULT 0,
  `created_at` datetime DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Estrutura para tabela `ticket_messages`
--

CREATE TABLE `ticket_messages` (
  `id` int(11) NOT NULL,
  `ticket_id` int(11) DEFAULT NULL,
  `user_id` int(11) DEFAULT NULL,
  `message` text DEFAULT NULL,
  `internal` tinyint(4) DEFAULT 0,
  `attachment` varchar(255) DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Despejando dados para a tabela `ticket_messages`
--

INSERT INTO `ticket_messages` (`id`, `ticket_id`, `user_id`, `message`, `internal`, `attachment`, `created_at`) VALUES
(1, 9, 1, 'Status alterado para: Concluído', 1, NULL, '2026-06-30 13:17:17'),
(2, 7, 1, 'Status alterado para: Concluído', 1, NULL, '2026-06-30 13:41:42'),
(3, 5, 1, 'RESOLVIDO', 0, NULL, '2026-07-01 16:27:57'),
(4, 5, 1, 'Status alterado para: Concluído', 1, NULL, '2026-07-01 16:28:34');

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

--
-- Estrutura para tabela `toner_history`
--

CREATE TABLE `toner_history` (
  `id` int(11) NOT NULL,
  `equipment_id` int(11) DEFAULT NULL,
  `toner_model` varchar(80) DEFAULT NULL,
  `quantity` int(11) DEFAULT 1,
  `counter` int(11) DEFAULT NULL,
  `notes` text DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Estrutura para tabela `users`
--

CREATE TABLE `users` (
  `id` int(11) NOT NULL,
  `name` varchar(120) DEFAULT NULL,
  `email` varchar(160) DEFAULT NULL,
  `password` varchar(255) DEFAULT NULL,
  `role` enum('admin','manager','agent','technician','customer') DEFAULT 'customer',
  `phone` varchar(30) DEFAULT NULL,
  `company` varchar(160) DEFAULT NULL,
  `active` tinyint(4) DEFAULT 1,
  `created_at` datetime DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Despejando dados para a tabela `users`
--

INSERT INTO `users` (`id`, `name`, `email`, `password`, `role`, `phone`, `company`, `active`, `created_at`) VALUES
(1, 'Administrador Superfax', 'admin@superfaxsolucoes.com.br', '$2y$10$D1nuWd9p8BmPWAg4qk.FH.lWx/LSuv0k4EiEit6QMN59315EwDi3i', 'admin', NULL, 'Superfax Soluções', 1, '2026-06-30 10:08:32'),
(2, 'Técnico Superfax', 'tecnico@superfaxsolucoes.com.br', '$2y$10$qwZt3j0eqU9RK4PmmPpS2.F4B/0cnwUCrSYuNqZURueWPxHZbxP7y', 'technician', NULL, 'Superfax Soluções', 1, '2026-06-30 10:08:32'),
(3, 'Cliente Demonstração', 'cliente@demo.com.br', '$2y$10$qwZt3j0eqU9RK4PmmPpS2.F4B/0cnwUCrSYuNqZURueWPxHZbxP7y', 'customer', NULL, 'Empresa Exemplo Ltda', 1, '2026-06-30 10:08:32'),
(8, 'Admin Teste', 'admin2@superfax.com', '$2y$10$OH7xWP93jG1B3VJBPbh/SO/.diQKm9AJ4eFyQrZcJLs4n3sHW/7i2', 'admin', '', 'Superfax', 1, '2026-06-30 10:18:09'),
(10, 'Marlon', 'kaiqueowen@hotmail.com', '$2y$10$R7Q4s94p1PnZEZQz.vtSAOauKW2QjBPjEdILf8eEi95rue8duN2Di', 'customer', '81987613030', 'PE FONE', 1, '2026-07-06 11:23:40');

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

--
-- Estrutura para tabela `whatsapp_contacts`
--

CREATE TABLE `whatsapp_contacts` (
  `id` int(11) NOT NULL,
  `customer_id` int(11) DEFAULT NULL,
  `name` varchar(160) DEFAULT NULL,
  `phone` varchar(30) NOT NULL,
  `company` varchar(160) DEFAULT NULL,
  `email` varchar(160) DEFAULT NULL,
  `tags` varchar(255) DEFAULT NULL,
  `last_message_at` datetime DEFAULT NULL,
  `created_at` datetime NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Estrutura para tabela `whatsapp_instances`
--

CREATE TABLE `whatsapp_instances` (
  `id` int(11) NOT NULL,
  `name` varchar(120) NOT NULL DEFAULT 'SUPERFAX',
  `phone` varchar(30) DEFAULT NULL,
  `status` varchar(30) NOT NULL DEFAULT 'desconectado',
  `api_url` varchar(255) DEFAULT NULL,
  `api_key` text DEFAULT NULL,
  `webhook_url` varchar(255) DEFAULT NULL,
  `last_sync` datetime DEFAULT NULL,
  `created_at` datetime NOT NULL DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Despejando dados para a tabela `whatsapp_instances`
--

INSERT INTO `whatsapp_instances` (`id`, `name`, `phone`, `status`, `api_url`, `api_key`, `webhook_url`, `last_sync`, `created_at`, `updated_at`) VALUES
(1, 'SUPERFAX', NULL, 'desconectado', 'http://localhost:8080', NULL, NULL, NULL, '2026-06-30 13:28:39', NULL);

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

--
-- Estrutura para tabela `whatsapp_logs`
--

CREATE TABLE `whatsapp_logs` (
  `id` int(11) NOT NULL,
  `level` varchar(20) NOT NULL DEFAULT 'info',
  `action` varchar(120) DEFAULT NULL,
  `message` text DEFAULT NULL,
  `payload` longtext DEFAULT NULL,
  `created_at` datetime NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Estrutura para tabela `whatsapp_messages`
--

CREATE TABLE `whatsapp_messages` (
  `id` int(11) NOT NULL,
  `customer_phone` varchar(60) DEFAULT NULL,
  `customer_name` varchar(160) DEFAULT NULL,
  `direction` enum('in','out') DEFAULT 'in',
  `message` text DEFAULT NULL,
  `ticket_id` int(11) DEFAULT NULL,
  `status` varchar(60) DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Estrutura para tabela `whatsapp_queue`
--

CREATE TABLE `whatsapp_queue` (
  `id` int(11) NOT NULL,
  `phone` varchar(30) NOT NULL,
  `message` text NOT NULL,
  `status` varchar(30) NOT NULL DEFAULT 'pendente',
  `attempts` int(11) NOT NULL DEFAULT 0,
  `last_error` text DEFAULT NULL,
  `scheduled_at` datetime DEFAULT NULL,
  `sent_at` datetime DEFAULT NULL,
  `created_at` datetime NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Estrutura para tabela `whatsapp_settings`
--

CREATE TABLE `whatsapp_settings` (
  `id` int(11) NOT NULL,
  `setting_key` varchar(100) NOT NULL,
  `setting_value` text DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Despejando dados para a tabela `whatsapp_settings`
--

INSERT INTO `whatsapp_settings` (`id`, `setting_key`, `setting_value`, `created_at`, `updated_at`) VALUES
(1, 'enabled', '0', '2026-06-30 13:21:45', NULL),
(2, 'provider', 'evolution', '2026-06-30 13:21:45', NULL),
(3, 'instance_name', 'superfax', '2026-06-30 13:21:45', NULL),
(4, 'default_department', 'Suporte Técnico', '2026-06-30 13:21:45', NULL),
(5, 'default_priority', 'media', '2026-06-30 13:21:45', NULL),
(6, 'auto_create_ticket', '1', '2026-06-30 13:21:45', NULL),
(7, 'auto_reply', '1', '2026-06-30 13:21:45', NULL),
(8, 'business_hours', 'Segunda a sexta, 08:00 às 18:00', '2026-06-30 13:21:45', NULL),
(9, 'welcome_message', 'Olá! Você está falando com o atendimento Superfax. Descreva o problema e informe o equipamento, setor ou patrimônio.', '2026-06-30 13:21:45', NULL),
(10, 'offline_message', 'Recebemos sua mensagem. Nosso horário de atendimento é {business_hours}. Seu chamado será analisado em breve.', '2026-06-30 13:21:45', NULL),
(11, 'ticket_created_message', 'Seu chamado #{ticket_id} foi aberto com sucesso. Nossa equipe técnica irá acompanhar a solicitação.', '2026-06-30 13:21:45', NULL),
(12, 'footer_message', 'SUPERFAX HelpDesk Enterprise', '2026-06-30 13:21:45', NULL);

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

--
-- Estrutura para tabela `whatsapp_templates`
--

CREATE TABLE `whatsapp_templates` (
  `id` int(11) NOT NULL,
  `name` varchar(120) NOT NULL,
  `category` varchar(80) DEFAULT NULL,
  `body` text NOT NULL,
  `active` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` datetime NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Despejando dados para a tabela `whatsapp_templates`
--

INSERT INTO `whatsapp_templates` (`id`, `name`, `category`, `body`, `active`, `created_at`) VALUES
(1, 'Protocolo criado', 'Chamados', 'Olá, {cliente}. Seu chamado {protocolo} foi aberto para o equipamento {equipamento}. Em breve um técnico dará continuidade.', 1, '2026-06-30 13:28:39'),
(2, 'Solicitação de toner', 'Toner', 'Recebemos sua solicitação de toner. Informe o patrimônio ou modelo do equipamento para localizarmos o contrato.', 1, '2026-06-30 13:28:39');

--
-- Índices para tabelas despejadas
--

--
-- Índices de tabela `approvals`
--
ALTER TABLE `approvals`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_ticket` (`ticket_id`),
  ADD KEY `idx_customer` (`customer_id`);

--
-- Índices de tabela `audit_logs`
--
ALTER TABLE `audit_logs`
  ADD PRIMARY KEY (`id`);

--
-- Índices de tabela `contracts`
--
ALTER TABLE `contracts`
  ADD PRIMARY KEY (`id`);

--
-- Índices de tabela `customers`
--
ALTER TABLE `customers`
  ADD PRIMARY KEY (`id`);

--
-- Índices de tabela `equipment`
--
ALTER TABLE `equipment`
  ADD PRIMARY KEY (`id`);

--
-- Índices de tabela `equipment_counter_history`
--
ALTER TABLE `equipment_counter_history`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_equipment_counter_equipment` (`equipment_id`),
  ADD KEY `idx_equipment_counter_date` (`reading_date`);

--
-- Índices de tabela `equipment_operational_events`
--
ALTER TABLE `equipment_operational_events`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_equipment_events_equipment` (`equipment_id`),
  ADD KEY `idx_equipment_events_date` (`event_date`);

--
-- Índices de tabela `equipment_parts_history`
--
ALTER TABLE `equipment_parts_history`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_equipment_parts_equipment` (`equipment_id`);

--
-- Índices de tabela `equipment_photos`
--
ALTER TABLE `equipment_photos`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_equipment_photos_equipment` (`equipment_id`);

--
-- Índices de tabela `invoices`
--
ALTER TABLE `invoices`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_customer` (`customer_id`),
  ADD KEY `idx_contract` (`contract_id`),
  ADD KEY `idx_due` (`due_date`);

--
-- Índices de tabela `knowledge_articles`
--
ALTER TABLE `knowledge_articles`
  ADD PRIMARY KEY (`id`);

--
-- Índices de tabela `maintenance_history`
--
ALTER TABLE `maintenance_history`
  ADD PRIMARY KEY (`id`);

--
-- Índices de tabela `message_templates`
--
ALTER TABLE `message_templates`
  ADD PRIMARY KEY (`id`);

--
-- Índices de tabela `settings`
--
ALTER TABLE `settings`
  ADD PRIMARY KEY (`key`);

--
-- Índices de tabela `stock_items`
--
ALTER TABLE `stock_items`
  ADD PRIMARY KEY (`id`);

--
-- Índices de tabela `stock_movements`
--
ALTER TABLE `stock_movements`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_item` (`item_id`),
  ADD KEY `idx_ticket` (`ticket_id`),
  ADD KEY `idx_equipment` (`equipment_id`);

--
-- Índices de tabela `technician_visits`
--
ALTER TABLE `technician_visits`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_ticket` (`ticket_id`),
  ADD KEY `idx_tech` (`technician_id`),
  ADD KEY `idx_equipment` (`equipment_id`);

--
-- Índices de tabela `tickets`
--
ALTER TABLE `tickets`
  ADD PRIMARY KEY (`id`);

--
-- Índices de tabela `ticket_attachments`
--
ALTER TABLE `ticket_attachments`
  ADD PRIMARY KEY (`id`);

--
-- Índices de tabela `ticket_messages`
--
ALTER TABLE `ticket_messages`
  ADD PRIMARY KEY (`id`);

--
-- Índices de tabela `toner_history`
--
ALTER TABLE `toner_history`
  ADD PRIMARY KEY (`id`);

--
-- Índices de tabela `users`
--
ALTER TABLE `users`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `email` (`email`),
  ADD UNIQUE KEY `uniq_users_email` (`email`);

--
-- Índices de tabela `whatsapp_contacts`
--
ALTER TABLE `whatsapp_contacts`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `uq_whatsapp_contacts_phone` (`phone`);

--
-- Índices de tabela `whatsapp_instances`
--
ALTER TABLE `whatsapp_instances`
  ADD PRIMARY KEY (`id`);

--
-- Índices de tabela `whatsapp_logs`
--
ALTER TABLE `whatsapp_logs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_whatsapp_logs_created` (`created_at`);

--
-- Índices de tabela `whatsapp_messages`
--
ALTER TABLE `whatsapp_messages`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_ticket` (`ticket_id`),
  ADD KEY `idx_phone` (`customer_phone`);

--
-- Índices de tabela `whatsapp_queue`
--
ALTER TABLE `whatsapp_queue`
  ADD PRIMARY KEY (`id`);

--
-- Índices de tabela `whatsapp_settings`
--
ALTER TABLE `whatsapp_settings`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `setting_key` (`setting_key`);

--
-- Índices de tabela `whatsapp_templates`
--
ALTER TABLE `whatsapp_templates`
  ADD PRIMARY KEY (`id`);

--
-- AUTO_INCREMENT para tabelas despejadas
--

--
-- AUTO_INCREMENT de tabela `approvals`
--
ALTER TABLE `approvals`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `audit_logs`
--
ALTER TABLE `audit_logs`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `contracts`
--
ALTER TABLE `contracts`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT de tabela `customers`
--
ALTER TABLE `customers`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT de tabela `equipment`
--
ALTER TABLE `equipment`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;

--
-- AUTO_INCREMENT de tabela `equipment_counter_history`
--
ALTER TABLE `equipment_counter_history`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `equipment_operational_events`
--
ALTER TABLE `equipment_operational_events`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `equipment_parts_history`
--
ALTER TABLE `equipment_parts_history`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `equipment_photos`
--
ALTER TABLE `equipment_photos`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `invoices`
--
ALTER TABLE `invoices`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT de tabela `knowledge_articles`
--
ALTER TABLE `knowledge_articles`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;

--
-- AUTO_INCREMENT de tabela `maintenance_history`
--
ALTER TABLE `maintenance_history`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `message_templates`
--
ALTER TABLE `message_templates`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT de tabela `stock_items`
--
ALTER TABLE `stock_items`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT de tabela `stock_movements`
--
ALTER TABLE `stock_movements`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `technician_visits`
--
ALTER TABLE `technician_visits`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `tickets`
--
ALTER TABLE `tickets`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;

--
-- AUTO_INCREMENT de tabela `ticket_attachments`
--
ALTER TABLE `ticket_attachments`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `ticket_messages`
--
ALTER TABLE `ticket_messages`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT de tabela `toner_history`
--
ALTER TABLE `toner_history`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `users`
--
ALTER TABLE `users`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;

--
-- AUTO_INCREMENT de tabela `whatsapp_contacts`
--
ALTER TABLE `whatsapp_contacts`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `whatsapp_instances`
--
ALTER TABLE `whatsapp_instances`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT de tabela `whatsapp_logs`
--
ALTER TABLE `whatsapp_logs`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `whatsapp_messages`
--
ALTER TABLE `whatsapp_messages`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `whatsapp_queue`
--
ALTER TABLE `whatsapp_queue`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `whatsapp_settings`
--
ALTER TABLE `whatsapp_settings`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;

--
-- AUTO_INCREMENT de tabela `whatsapp_templates`
--
ALTER TABLE `whatsapp_templates`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
