-- https://www.phpmyadmin.net/
--

START TRANSACTION;



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

--
-- Table structure for table `categories`
--

CREATE TABLE `categories` (
  `id` int(11) NOT NULL,
  `bot_id` int(11) NOT NULL,
  `name` varchar(255) NOT NULL,
  `thumbnail_url` varchar(2048) DEFAULT NULL,
  `display_order` int(11) DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `categories`
--

INSERT INTO `categories` (`id`, `bot_id`, `name`, `thumbnail_url`, `display_order`) VALUES
(1, 1, 'greetings', '', 0),
(4, 1, 'issues', '', 0),
(5, 1, 'issues', '', 0),
(6, 1, 'Hello', '', 0),
(7, 1, 'New', '', 0),
(9, 1, 'Last', '', 0),
(10, 1, 'new cat', '', 0),
(11, 1, 'hmm', '', 0),
(12, 1, 'Now cat', '', 0),
(13, 1, 'hope', '', 0),
(14, 1, 'ffdd', '', 0),
(17, 3, 'deprem2', '\"http://localhost/posrednik/posrednik-api/public\"/uploads/thumb_6898e379beaa62.03027067.png', 0),
(18, 3, 'no', '\"http://localhost/posrednik/posrednik-api/public\"/uploads/thumb_6898e5348bcbd2.73757323.png', 0),
(19, 3, 'ddd', '\"http://localhost/posrednik/posrednik-api/public\"/uploads/thumb_6898e5d37f46d0.53956274.png', 0),
(20, 3, 'ddd', '\"http://localhost/posrednik/posrednik-api/public\"/uploads/thumb_6898e89e6e8248.66313083.png', 0),
(21, 1, 'sssssssss', '', 0),
(22, 1, 'Hello world', NULL, 0);

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

--
-- Table structure for table `clients`
--

CREATE TABLE `clients` (
  `id` int(11) NOT NULL,
  `name` varchar(255) NOT NULL,
  `contact_person` varchar(255) DEFAULT NULL,
  `contact_email` varchar(255) DEFAULT NULL,
  `status` enum('active','inactive','trial') DEFAULT 'trial',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `clients`
--

INSERT INTO `clients` (`id`, `name`, `contact_person`, `contact_email`, `status`, `created_at`, `updated_at`) VALUES
(1, 'Glo', 'John Doe', NULL, 'active', '2025-08-09 12:44:03', '2025-08-10 21:08:25'),
(3, 'Juria', 'Juria', NULL, 'trial', '2025-08-09 13:13:33', '2025-08-09 13:13:33');

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

--
-- Table structure for table `conversations`
--

CREATE TABLE `conversations` (
  `id` bigint(20) NOT NULL,
  `bot_id` int(11) NOT NULL,
  `user_identifier` varchar(255) NOT NULL,
  `user_message` text DEFAULT NULL,
  `bot_response` text DEFAULT NULL,
  `status` enum('processed','failed','pending') DEFAULT 'processed',
  `timestamp` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `intents`
--

CREATE TABLE `intents` (
  `id` int(11) NOT NULL,
  `category_id` int(11) NOT NULL,
  `question` varchar(255) NOT NULL,
  `response` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `intents`
--

INSERT INTO `intents` (`id`, `category_id`, `question`, `response`) VALUES
(1, 1, 'Hello', 'Hi'),
(2, 6, 'Hi', 'Hello'),
(4, 11, 'Hello', 'Hi'),
(5, 17, 'fff', 'sss'),
(6, 19, 'fffff', 'dddd'),
(9, 14, 'dd', 'ddddd');

--
-- Indexes for table `categories`
--
ALTER TABLE `categories`
  ADD PRIMARY KEY (`id`),
  ADD KEY `bot_id` (`bot_id`);

--
-- Indexes for table `clients`
--
ALTER TABLE `clients`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `conversations`
--
ALTER TABLE `conversations`
  ADD PRIMARY KEY (`id`),
  ADD KEY `bot_id` (`bot_id`);

--
-- Indexes for table `intents`
--
ALTER TABLE `intents`
  ADD PRIMARY KEY (`id`),
  ADD KEY `category_id` (`category_id`);

--
-- AUTO_INCREMENT for table `categories`
--
ALTER TABLE `categories`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=23;

--
-- AUTO_INCREMENT for table `clients`
--
ALTER TABLE `clients`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `conversations`
--
ALTER TABLE `conversations`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `intents`
--
ALTER TABLE `intents`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;

--
-- Constraints for table `categories`
--
ALTER TABLE `categories`
  ADD CONSTRAINT `categories_ibfk_1` FOREIGN KEY (`bot_id`) REFERENCES `bots` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `conversations`
--
ALTER TABLE `conversations`
  ADD CONSTRAINT `conversations_ibfk_1` FOREIGN KEY (`bot_id`) REFERENCES `bots` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `intents`
--
ALTER TABLE `intents`
  ADD CONSTRAINT `intents_ibfk_1` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`) ON DELETE CASCADE;
COMMIT;

