-- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1:3306
-- Generation Time: Apr 07, 2026 at 09:01 AM
-- Server version: 9.1.0
-- PHP Version: 8.4.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 */;

--
-- Database: `prolex`
--

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

--
-- Table structure for table `account_types`
--

DROP TABLE IF EXISTS `account_types`;
CREATE TABLE IF NOT EXISTS `account_types` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `code` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `created_by` bigint UNSIGNED DEFAULT NULL,
  `updated_by` bigint UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `account_types_code_unique` (`code`),
  KEY `account_types_created_by_foreign` (`created_by`),
  KEY `account_types_updated_by_foreign` (`updated_by`)
) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `account_types`
--

INSERT INTO `account_types` (`id`, `name`, `code`, `description`, `created_by`, `updated_by`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 'Asset', 'ASSET', 'Resources owned by the business', 1, 1, '2026-03-31 08:38:19', '2026-03-31 08:38:19', NULL),
(2, 'Liability', 'LIABILITY', 'Obligations owed to others', 1, 1, '2026-03-31 08:38:19', '2026-03-31 08:38:19', NULL),
(3, 'Equity', 'EQUITY', 'Owner residual interest in the business', 1, 1, '2026-03-31 08:38:19', '2026-03-31 08:38:19', NULL),
(4, 'Revenue', 'REVENUE', 'Income earned from primary operations', 1, 1, '2026-03-31 08:38:19', '2026-03-31 08:38:19', NULL),
(5, 'Expense', 'EXPENSE', 'Operational costs incurred', 1, 1, '2026-03-31 08:38:19', '2026-03-31 08:38:19', NULL),
(6, 'Cost of Goods Sold', 'COGS', 'Direct costs tied to revenue generation', 1, 1, '2026-03-31 08:38:19', '2026-03-31 08:38:19', NULL),
(7, 'Other Income', 'OTHER_INCOME', 'Non-operating income sources', 1, 1, '2026-03-31 08:38:19', '2026-03-31 08:38:19', NULL),
(8, 'Other Expense', 'OTHER_EXPENSE', 'Non-operating expenses', 1, 1, '2026-03-31 08:38:19', '2026-03-31 08:38:19', NULL),
(9, 'Current Asset', 'CURRENT_ASSET', 'Accounts that offset asset balances', 1, 1, '2026-03-31 08:38:19', '2026-03-31 08:38:19', NULL),
(10, 'Current Liability', 'CURRENT_LIABILITY', 'Accounts that offset liability balances', 1, 1, '2026-03-31 08:38:19', '2026-03-31 08:38:19', NULL),
(12, 'Cash & Cash Equivalent', 'CASH_EQUIVALENT', 'Cash & Cash Equivalent', 1, 1, '2026-03-31 08:38:19', '2026-03-31 08:38:19', NULL),
(13, 'Accounts Receivable', 'ACCOUNTS_RECEIVABLE', 'Accounts Receivable', 1, 1, '2026-03-31 08:38:19', '2026-03-31 08:38:19', NULL),
(14, 'Accounts Payable', 'ACCOUNTS_PAYABLE', 'Accounts Payable', 1, 1, '2026-03-31 08:38:19', '2026-03-31 08:38:19', NULL),
(15, 'Fixed Assets', 'FIXED_ASSETS', 'Fixed Assets', 1, 1, '2026-03-31 08:38:19', '2026-03-31 08:38:19', NULL),
(16, 'Long-Term Liabilities', 'LONG_TERM_LIABILITIES', 'Long-Term Liabilities', 1, 1, '2026-03-31 08:38:19', '2026-03-31 08:38:19', NULL),
(17, 'Trust Account - Current Asset', 'TRUST_CURRENT_ASSET', 'Trust Account - Current Asset', 1, 1, '2026-03-31 08:38:19', '2026-03-31 08:38:19', NULL),
(18, 'Trust Account - Current Liability', 'TRUST_CURRENT_LIABILITY', 'Trust Account - Current Liability', 1, 1, '2026-03-31 08:38:19', '2026-03-31 08:38:19', NULL),
(19, 'Trust Account - Expense', 'TRUST_EXPENSE', 'Trust Account - Expense', 1, 1, '2026-03-31 08:38:19', '2026-03-31 08:38:19', NULL),
(20, 'Trust Account - Accounts Payable', 'TRUST_AP', 'Trust Account - Accounts Payable', 1, 1, '2026-03-31 08:38:19', '2026-03-31 08:38:19', NULL),
(21, 'Trust Account - Accounts Receivable', 'TRUST_AR', 'Trust Account - Accounts Receivable', 1, 1, '2026-03-31 08:38:19', '2026-03-31 08:38:19', NULL),
(22, 'Trust Account - Income', 'TRUST_INCOME', 'Trust Account - Income', 1, 1, '2026-03-31 08:38:19', '2026-03-31 08:38:19', NULL),
(23, 'Trust Account - Cash & Cash Equivalent', 'TRUST_CASH_EQUIVALENT', 'Trust Account - Cash & Cash Equivalent', 1, 1, '2026-03-31 08:38:19', '2026-03-31 08:38:19', NULL),
(24, 'SHELBY', 'TOMM', 'ACC FOR ME', 1, 1, '2026-04-01 13:45:26', '2026-04-01 13:46:12', '2026-04-01 13:46:12');

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

--
-- Table structure for table `billing_audit_log`
--

DROP TABLE IF EXISTS `billing_audit_log`;
CREATE TABLE IF NOT EXISTS `billing_audit_log` (
  `log_id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `table_name` varchar(80) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `record_id` bigint UNSIGNED NOT NULL,
  `action` enum('INSERT','UPDATE','DELETE') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `changed_field` varchar(80) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `old_value` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `new_value` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `changed_by` bigint UNSIGNED NOT NULL,
  `changed_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `ip_address` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `session_token` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`log_id`),
  KEY `idx_bal_table` (`table_name`,`record_id`),
  KEY `idx_bal_user` (`changed_by`),
  KEY `idx_bal_at` (`changed_at`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Append-only billing audit trail. Every INSERT/UPDATE/DELETE on any billing table is written here. Required for regulatory compliance.';

--
-- Dumping data for table `billing_audit_log`
--

INSERT INTO `billing_audit_log` (`log_id`, `table_name`, `record_id`, `action`, `changed_field`, `old_value`, `new_value`, `changed_by`, `changed_at`, `ip_address`, `session_token`) VALUES
(1, 'client_invoices', 1, 'UPDATE', 'status', 'sent', 'partial', 1, '2026-03-27 06:19:38', NULL, NULL),
(2, 'tariff_time_logs', 1, 'UPDATE', 'status', 'approved', 'billed', 1, '2026-03-27 06:19:38', NULL, NULL);

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

--
-- Table structure for table `cache_store`
--

DROP TABLE IF EXISTS `cache_store`;
CREATE TABLE IF NOT EXISTS `cache_store` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `cache_key` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `cache_value` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `expires_at` timestamp NULL DEFAULT NULL,
  `is_locked` tinyint(1) DEFAULT '0',
  `locked_by` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `lock_expires_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `cache_key` (`cache_key`),
  KEY `idx_cache_expires` (`expires_at`),
  KEY `idx_cache_locked` (`is_locked`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `cases`
--

DROP TABLE IF EXISTS `cases`;
CREATE TABLE IF NOT EXISTS `cases` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `matter_id` bigint UNSIGNED DEFAULT NULL,
  `court_id` bigint UNSIGNED DEFAULT NULL,
  `court_case_number` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `filing_date` date DEFAULT NULL,
  `incident_date` date DEFAULT NULL,
  `litigation_stage` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `next_hearing_date` date DEFAULT NULL,
  `case_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `case_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `category_code` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `type_id` int DEFAULT NULL,
  `status_code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `reason_code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `outcome_code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `priority_id` int DEFAULT NULL,
  `role_id` int DEFAULT NULL,
  `notes` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `created_by` int DEFAULT NULL,
  `updated_by` int DEFAULT NULL,
  `date_of_incident` date DEFAULT NULL,
  `court_appearance_date` date DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `case_id` (`case_id`),
  KEY `cases_matter_id_index` (`matter_id`)
) ENGINE=InnoDB AUTO_INCREMENT=51 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `cases`
--

INSERT INTO `cases` (`id`, `matter_id`, `court_id`, `court_case_number`, `filing_date`, `incident_date`, `litigation_stage`, `next_hearing_date`, `case_id`, `case_name`, `category_code`, `type_id`, `status_code`, `reason_code`, `outcome_code`, `priority_id`, `role_id`, `notes`, `created_by`, `updated_by`, `date_of_incident`, `court_appearance_date`, `created_at`, `updated_at`) VALUES
(1, 1, NULL, NULL, NULL, NULL, NULL, NULL, 'case1001', 'Breach of Contract – Vendor', 'CIV', 2, 'open', NULL, NULL, 3, 10, 'Dispute over delayed vendor deliverables.', 1, 1, '2024-01-12', '2024-03-20', '2026-03-13 11:22:12', '2026-03-18 13:51:59'),
(2, 2, NULL, NULL, NULL, NULL, NULL, NULL, 'case1002', 'Assault Investigation', 'CRM', 4, 'pend', NULL, NULL, 5, 11, 'Investigation pending witness statements.', 1, 1, '2023-11-03', '2024-02-15', '2026-03-13 11:22:12', '2026-03-18 13:51:59'),
(3, 3, NULL, NULL, NULL, NULL, NULL, NULL, 'case1003', 'Patent Infringement Claim', 'IP', 5, 'open', NULL, NULL, 6, 12, 'Alleged infringement of registered process patent.', 1, 1, '2024-02-01', '2024-04-10', '2026-03-13 11:22:12', '2026-03-18 13:51:59'),
(4, 4, NULL, NULL, NULL, NULL, NULL, NULL, 'case1004', 'Employment Termination Dispute', 'CIV', 2, 'open', NULL, NULL, 4, 10, 'Client contesting wrongful dismissal.', 1, 1, '2024-01-20', '2024-03-15', '2026-03-13 11:22:12', '2026-03-18 13:51:59'),
(5, 5, NULL, NULL, NULL, NULL, NULL, NULL, 'case1005', 'Trademark Opposition', 'IP', 3, 'open', NULL, NULL, 2, 11, 'Opposition filed against trademark registration.', 1, 1, '2024-02-05', '2024-04-01', '2026-03-13 11:22:12', '2026-03-18 13:51:59'),
(6, 6, NULL, NULL, NULL, NULL, NULL, NULL, 'case1006', 'Landlord-Tenant Dispute', 'CIV', 2, 'open', NULL, NULL, 3, 12, 'Tenant refusing to vacate property.', 1, 1, '2024-01-18', '2024-03-10', '2026-03-13 11:22:12', '2026-03-18 13:51:59'),
(7, 7, NULL, NULL, NULL, NULL, NULL, NULL, 'case1007', 'Product Liability Claim', 'CIV', 5, 'open', NULL, NULL, 4, 10, 'Injury caused by defective product.', 1, 1, '2024-01-22', '2024-03-18', '2026-03-13 11:22:12', '2026-03-18 13:51:59'),
(8, 8, NULL, NULL, NULL, NULL, NULL, NULL, 'case1008', 'Fraud Investigation', 'CRM', 4, 'pend', NULL, NULL, 5, 11, 'Financial irregularities under review.', 1, 1, '2024-02-01', '2024-04-05', '2026-03-13 11:22:12', '2026-03-18 13:51:59'),
(9, 9, NULL, NULL, NULL, NULL, NULL, NULL, 'case1009', 'Copyright Infringement', 'IP', 5, 'open', NULL, NULL, 6, 12, 'Unauthorized use of copyrighted material.', 1, 1, '2024-01-25', '2024-03-25', '2026-03-13 11:22:12', '2026-03-18 13:51:59'),
(10, 10, NULL, NULL, NULL, NULL, NULL, NULL, 'case1010', 'Medical Malpractice', 'CIV', 3, 'open', NULL, NULL, 4, 10, 'Negligence claim against hospital staff.', 1, 1, '2024-02-10', '2024-04-15', '2026-03-13 11:22:12', '2026-03-18 13:51:59'),
(11, 11, NULL, NULL, NULL, NULL, NULL, NULL, 'case1011', 'Insurance Dispute', 'CIV', 2, 'open', NULL, NULL, 3, 11, 'Claim denied by insurance provider.', 1, 1, '2024-01-30', '2024-03-28', '2026-03-13 11:22:12', '2026-03-18 13:51:59'),
(12, 12, NULL, NULL, NULL, NULL, NULL, NULL, 'case1012', 'Environmental Regulation Violation', 'CIV', 4, 'pend', NULL, NULL, 5, 12, 'Pollution incident under investigation.', 1, 1, '2024-02-15', '2024-04-20', '2026-03-13 11:22:12', '2026-03-18 13:51:59'),
(13, 13, NULL, NULL, NULL, NULL, NULL, NULL, 'case1013', 'Cybercrime Investigation', 'CRM', 5, 'pend', NULL, NULL, 6, 10, 'Hacking incident affecting multiple clients.', 1, 1, '2024-01-10', '2024-03-12', '2026-03-13 11:22:12', '2026-03-18 13:51:59'),
(14, 14, NULL, NULL, NULL, NULL, NULL, NULL, 'case1014', 'Construction Dispute', 'CIV', 2, 'open', NULL, NULL, 4, 11, 'Contractor failing to meet specifications.', 1, 1, '2024-01-15', '2024-03-10', '2026-03-13 11:22:12', '2026-03-18 13:51:59'),
(15, 15, NULL, NULL, NULL, NULL, NULL, NULL, 'case1015', 'Vehicle Accident Claim', 'CIV', 3, 'open', NULL, NULL, 3, 12, 'Road accident, multiple parties involved.', 1, 1, '2024-02-05', '2024-03-30', '2026-03-13 11:22:12', '2026-03-18 13:51:59'),
(16, 16, NULL, NULL, NULL, NULL, NULL, NULL, 'case1016', 'Tax Evasion Investigation', 'CRM', 4, 'pend', NULL, NULL, 5, 10, 'Audit for undeclared income.', 1, 1, '2024-01-28', '2024-03-22', '2026-03-13 11:22:12', '2026-03-18 13:51:59'),
(17, 17, NULL, NULL, NULL, NULL, NULL, NULL, 'case1017', 'Intellectual Property Licensing Dispute', 'IP', 5, 'open', NULL, NULL, 6, 11, 'Breach of licensing agreement.', 1, 1, '2024-02-12', '2024-04-10', '2026-03-13 11:22:12', '2026-03-18 13:51:59'),
(18, 18, NULL, NULL, NULL, NULL, NULL, NULL, 'case1018', 'Debt Recovery', 'CIV', 2, 'open', NULL, NULL, 3, 12, 'Client seeking recovery of unpaid invoices.', 1, 1, '2024-01-18', '2024-03-15', '2026-03-13 11:22:12', '2026-03-18 13:51:59'),
(19, 19, NULL, NULL, NULL, NULL, NULL, NULL, 'case1019', 'Bankruptcy Proceedings', 'CIV', 3, 'pend', NULL, NULL, 4, 10, 'Liquidation process initiated.', 1, 1, '2024-02-01', '2024-04-05', '2026-03-13 11:22:12', '2026-03-18 13:51:59'),
(20, 20, NULL, NULL, NULL, NULL, NULL, NULL, 'case1020', 'Criminal Theft Case', 'CRM', 4, 'pend', NULL, NULL, 5, 11, 'Investigation ongoing.', 1, 1, '2024-01-12', '2024-03-10', '2026-03-13 11:22:12', '2026-03-18 13:51:59'),
(21, 21, NULL, NULL, NULL, NULL, NULL, NULL, 'case1021', 'Consumer Rights Violation', 'CIV', 2, 'open', NULL, NULL, 3, 12, 'Complaint against retailer.', 1, 1, '2024-01-20', '2024-03-15', '2026-03-13 11:22:12', '2026-03-18 13:51:59'),
(22, 22, NULL, NULL, NULL, NULL, NULL, NULL, 'case1022', 'Antitrust Investigation', 'CIV', 3, 'pend', NULL, NULL, 4, 10, 'Market manipulation under review.', 1, 1, '2024-02-01', '2024-04-01', '2026-03-13 11:22:12', '2026-03-18 13:51:59'),
(23, 23, NULL, NULL, NULL, NULL, NULL, NULL, 'case1023', 'Harassment Complaint', 'CRM', 4, 'pend', NULL, NULL, 5, 11, 'Investigation into workplace harassment.', 1, 1, '2024-01-25', '2024-03-25', '2026-03-13 11:22:12', '2026-03-18 13:51:59'),
(24, 24, NULL, NULL, NULL, NULL, NULL, NULL, 'case1024', 'Fraudulent Contract', 'CIV', 2, 'open', NULL, NULL, 3, 12, 'Alleged fraudulent business contract.', 1, 1, '2024-01-28', '2024-03-20', '2026-03-13 11:22:12', '2026-03-18 13:51:59'),
(25, 25, NULL, NULL, NULL, NULL, NULL, NULL, 'case1025', 'Sample Case 25', 'CIV', 3, 'open', NULL, NULL, 4, 10, 'Placeholder case for testing.', 1, 1, '2024-02-05', '2024-04-01', '2026-03-13 11:22:12', '2026-03-18 13:51:59'),
(26, 1, NULL, NULL, NULL, NULL, NULL, NULL, 'CASE-0001', 'Case for Breach of Contract – Vendor', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Seeded case linked to matter', 8, 8, NULL, NULL, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(27, 2, NULL, NULL, NULL, NULL, NULL, NULL, 'CASE-0002', 'Case for Assault Investigation', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Seeded case linked to matter', 8, 8, NULL, NULL, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(28, 3, NULL, NULL, NULL, NULL, NULL, NULL, 'CASE-0003', 'Case for Patent Infringement Claim', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Seeded case linked to matter', 8, 8, NULL, NULL, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(29, 4, NULL, NULL, NULL, NULL, NULL, NULL, 'CASE-0004', 'Case for Employment Termination Dispute', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Seeded case linked to matter', 8, 8, NULL, NULL, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(30, 5, NULL, NULL, NULL, NULL, NULL, NULL, 'CASE-0005', 'Case for Trademark Opposition', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Seeded case linked to matter', 8, 8, NULL, NULL, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(31, 6, NULL, NULL, NULL, NULL, NULL, NULL, 'CASE-0006', 'Case for Landlord-Tenant Dispute', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Seeded case linked to matter', 8, 8, NULL, NULL, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(32, 7, NULL, NULL, NULL, NULL, NULL, NULL, 'CASE-0007', 'Case for Product Liability Claim', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Seeded case linked to matter', 8, 8, NULL, NULL, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(33, 8, NULL, NULL, NULL, NULL, NULL, NULL, 'CASE-0008', 'Case for Fraud Investigation', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Seeded case linked to matter', 8, 8, NULL, NULL, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(34, 9, NULL, NULL, NULL, NULL, NULL, NULL, 'CASE-0009', 'Case for Copyright Infringement', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Seeded case linked to matter', 8, 8, NULL, NULL, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(35, 10, NULL, NULL, NULL, NULL, NULL, NULL, 'CASE-0010', 'Case for Medical Malpractice', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Seeded case linked to matter', 8, 8, NULL, NULL, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(36, 11, NULL, NULL, NULL, NULL, NULL, NULL, 'CASE-0011', 'Case for Insurance Dispute', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Seeded case linked to matter', 8, 8, NULL, NULL, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(37, 12, NULL, NULL, NULL, NULL, NULL, NULL, 'CASE-0012', 'Case for Environmental Regulation Violation', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Seeded case linked to matter', 8, 8, NULL, NULL, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(38, 13, NULL, NULL, NULL, NULL, NULL, NULL, 'CASE-0013', 'Case for Cybercrime Investigation', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Seeded case linked to matter', 8, 8, NULL, NULL, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(39, 14, NULL, NULL, NULL, NULL, NULL, NULL, 'CASE-0014', 'Case for Construction Dispute', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Seeded case linked to matter', 8, 8, NULL, NULL, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(40, 15, NULL, NULL, NULL, NULL, NULL, NULL, 'CASE-0015', 'Case for Vehicle Accident Claim', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Seeded case linked to matter', 8, 8, NULL, NULL, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(41, 16, NULL, NULL, NULL, NULL, NULL, NULL, 'CASE-0016', 'Case for Tax Evasion Investigation', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Seeded case linked to matter', 8, 8, NULL, NULL, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(42, 17, NULL, NULL, NULL, NULL, NULL, NULL, 'CASE-0017', 'Case for Intellectual Property Licensing Dispute', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Seeded case linked to matter', 8, 8, NULL, NULL, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(43, 18, NULL, NULL, NULL, NULL, NULL, NULL, 'CASE-0018', 'Case for Debt Recovery', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Seeded case linked to matter', 8, 8, NULL, NULL, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(44, 19, NULL, NULL, NULL, NULL, NULL, NULL, 'CASE-0019', 'Case for Bankruptcy Proceedings', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Seeded case linked to matter', 8, 8, NULL, NULL, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(45, 20, NULL, NULL, NULL, NULL, NULL, NULL, 'CASE-0020', 'Case for Criminal Theft Case', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Seeded case linked to matter', 8, 8, NULL, NULL, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(46, 21, NULL, NULL, NULL, NULL, NULL, NULL, 'CASE-0021', 'Case for Consumer Rights Violation', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Seeded case linked to matter', 8, 8, NULL, NULL, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(47, 22, NULL, NULL, NULL, NULL, NULL, NULL, 'CASE-0022', 'Case for Antitrust Investigation', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Seeded case linked to matter', 8, 8, NULL, NULL, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(48, 23, NULL, NULL, NULL, NULL, NULL, NULL, 'CASE-0023', 'Case for Harassment Complaint', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Seeded case linked to matter', 8, 8, NULL, NULL, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(49, 24, NULL, NULL, NULL, NULL, NULL, NULL, 'CASE-0024', 'Case for Fraudulent Contract', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Seeded case linked to matter', 8, 8, NULL, NULL, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(50, 25, NULL, NULL, NULL, NULL, NULL, NULL, 'CASE-0025', 'Case for Sample Case 25', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Seeded case linked to matter', 8, 8, NULL, NULL, '2026-03-19 11:10:20', '2026-03-19 11:10:20');

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

--
-- Table structure for table `case_categories`
--

DROP TABLE IF EXISTS `case_categories`;
CREATE TABLE IF NOT EXISTS `case_categories` (
  `category_code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `category_description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`category_code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `case_categories`
--

INSERT INTO `case_categories` (`category_code`, `category_description`, `created_at`, `updated_at`) VALUES
('ADM', 'Administrative Law', '2026-01-22 14:06:22', '2026-01-22 14:06:22'),
('BNK', 'Bankruptcy & Insolvency', '2026-01-22 14:06:22', '2026-01-23 11:27:59'),
('BOLO', 'DSDSSS', '2026-01-23 08:54:10', '2026-01-23 11:24:48'),
('CIV', 'Civil Litigation', '2026-01-16 10:44:09', '2026-01-16 10:44:09'),
('CON', 'Construction Law', '2026-01-22 14:06:22', '2026-01-22 14:06:22'),
('COR', 'Corporate & Commercial', '2026-01-16 10:44:09', '2026-01-16 10:44:09'),
('CRM', 'Criminal Defense', '2026-01-16 10:44:09', '2026-01-16 10:44:09'),
('EMP', 'Employment & Labor Law', '2026-01-16 10:44:09', '2026-01-16 10:44:09'),
('ENV', 'Environmental Law', '2026-01-22 14:06:22', '2026-01-22 14:06:22'),
('EST', 'Estate Planning & Probate', '2026-01-22 14:06:22', '2026-01-22 14:06:22'),
('FAM', 'Family Law', '2026-01-16 10:44:09', '2026-01-16 10:44:09'),
('IMM', 'Immigration Law', '2026-01-22 14:06:22', '2026-01-22 14:06:22'),
('INS', 'Insurance Law', '2026-01-22 14:06:22', '2026-01-22 14:06:22'),
('INT', 'International Law', '2026-01-22 14:06:22', '2026-01-22 14:06:22'),
('IP', 'Intellectual Property', '2026-01-16 10:44:09', '2026-01-16 10:44:09'),
('MED', 'Medical Malpractice', '2026-01-22 14:06:22', '2026-01-22 14:06:22'),
('TAX', 'Taxation Law', '2026-01-22 14:06:22', '2026-01-22 14:06:22');

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

--
-- Table structure for table `case_clients`
--

DROP TABLE IF EXISTS `case_clients`;
CREATE TABLE IF NOT EXISTS `case_clients` (
  `id` int NOT NULL AUTO_INCREMENT,
  `case_id` int NOT NULL,
  `client_id` int NOT NULL,
  `role_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_by` bigint UNSIGNED NOT NULL,
  `updated_by` bigint UNSIGNED NOT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `case_id` (`case_id`,`client_id`),
  KEY `fk_case_clients_client` (`client_id`),
  KEY `fk_case_clients_role` (`role_code`)
) ENGINE=InnoDB AUTO_INCREMENT=151 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `case_clients`
--

INSERT INTO `case_clients` (`id`, `case_id`, `client_id`, `role_code`, `created_by`, `updated_by`, `created_at`, `updated_at`) VALUES
(121, 1, 1, 'Plaintiff', 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(122, 2, 2, 'Plaintiff', 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(123, 2, 3, 'Co-Plaintiff', 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(124, 3, 4, 'Defendant', 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(125, 3, 5, 'Co-Defendant', 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(126, 4, 6, 'Plaintiff', 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(127, 4, 7, 'Co-Plaintiff', 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(128, 4, 8, 'Respondent', 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(129, 5, 9, 'Defendant', 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(130, 6, 10, 'Plaintiff', 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(131, 6, 11, 'Respondent', 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(132, 7, 12, 'Defendant', 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(133, 7, 13, 'Co-Defendant', 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(134, 7, 14, 'Applicant', 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(135, 8, 15, 'Plaintiff', 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(136, 8, 16, 'Co-Plaintiff', 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(137, 8, 17, 'Applicant', 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(138, 8, 18, 'Respondent', 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(139, 9, 19, 'Plaintiff', 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(140, 10, 20, 'Defendant', 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(141, 10, 21, 'Respondent', 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(142, 11, 22, 'Plaintiff', 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(143, 11, 23, 'Applicant', 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(144, 11, 24, 'Respondent', 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(145, 12, 25, 'Defendant', 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(146, 12, 26, 'Co-Defendant', 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(147, 12, 27, 'Applicant', 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(148, 12, 28, 'Respondent', 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(149, 13, 29, 'Plaintiff', 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(150, 13, 30, 'Respondent', 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18');

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

--
-- Table structure for table `case_lawyers`
--

DROP TABLE IF EXISTS `case_lawyers`;
CREATE TABLE IF NOT EXISTS `case_lawyers` (
  `case_lawyer_id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `case_id` bigint UNSIGNED NOT NULL,
  `lawyer_id` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `lawyer_role_id` int UNSIGNED NOT NULL,
  `tier_id` bigint UNSIGNED DEFAULT NULL,
  `tariff_id` bigint UNSIGNED DEFAULT NULL,
  `start_date` date DEFAULT NULL,
  `end_date` date DEFAULT NULL,
  `is_active` tinyint(1) DEFAULT '1',
  `notes` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`case_lawyer_id`),
  UNIQUE KEY `unique_case_lawyer` (`case_id`,`lawyer_id`),
  KEY `lawyer_id` (`lawyer_id`),
  KEY `tier_id` (`tier_id`),
  KEY `tariff_id` (`tariff_id`),
  KEY `fk_case_lawyer_role` (`lawyer_role_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `case_outcomes`
--

DROP TABLE IF EXISTS `case_outcomes`;
CREATE TABLE IF NOT EXISTS `case_outcomes` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `updated_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `id` (`id`),
  UNIQUE KEY `code` (`code`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `case_outcomes`
--

INSERT INTO `case_outcomes` (`id`, `code`, `name`, `description`, `updated_at`, `created_at`) VALUES
(1, 'WON', 'Won', 'Case resolved in favor of the client', NULL, NULL),
(2, 'LOST', 'Lost', 'Case resolved against the client', NULL, NULL),
(3, 'SETTLED', 'Settled', 'Case resolved via settlement agreement', NULL, NULL),
(4, 'DISMISSED', 'Dismissed', 'Case dismissed by the court', '2026-01-19 06:05:49', NULL),
(5, 'WITHDRAWN', 'Withdrawn', 'Case withdrawn by the client or attorney', NULL, NULL),
(6, 'PENDING', 'Pending', 'Case still ongoing, no final outcome yet', NULL, NULL),
(7, 'APPEALED', 'Appealed', 'Case outcome is under appeal', NULL, NULL);

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

--
-- Table structure for table `case_parties`
--

DROP TABLE IF EXISTS `case_parties`;
CREATE TABLE IF NOT EXISTS `case_parties` (
  `case_party_id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `case_id` bigint UNSIGNED NOT NULL,
  `client_id` bigint UNSIGNED NOT NULL,
  `role_id` int NOT NULL,
  `party_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `notes` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `created_by` bigint UNSIGNED NOT NULL,
  `updated_by` bigint UNSIGNED NOT NULL,
  PRIMARY KEY (`case_party_id`),
  KEY `fk_case_parties_case` (`case_id`),
  KEY `fk_case_parties_client` (`client_id`),
  KEY `fk_case_parties_role` (`role_id`)
) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `case_parties`
--

INSERT INTO `case_parties` (`case_party_id`, `case_id`, `client_id`, `role_id`, `party_name`, `notes`, `created_at`, `updated_at`, `created_by`, `updated_by`) VALUES
(1, 1, 31, 5, 'John Doe', 'Witness for the case', '2026-03-13 11:56:24', '2026-03-13 11:56:24', 1, 1),
(2, 2, 32, 5, 'Jane Smith', 'Testifying witness', '2026-03-13 11:56:24', '2026-03-13 11:56:24', 1, 1),
(3, 2, 33, 6, 'Acme Corp', 'Third party involved', '2026-03-13 11:56:24', '2026-03-13 11:56:24', 1, 1),
(4, 3, 34, 5, 'Robert Brown', 'Expert witness', '2026-03-13 11:56:24', '2026-03-13 11:56:24', 1, 1),
(5, 3, 35, 6, 'Linda White', 'Third party consultant', '2026-03-13 11:56:24', '2026-03-13 11:56:24', 1, 1),
(6, 3, 36, 6, 'Global LLC', 'Corporate third party', '2026-03-13 11:56:24', '2026-03-13 11:56:24', 1, 1),
(7, 4, 37, 5, 'Peter Davis', 'Supporting witness', '2026-03-13 11:56:24', '2026-03-13 11:56:24', 1, 1),
(8, 4, 38, 5, 'Susan Miller', 'Witness providing testimony', '2026-03-13 11:56:24', '2026-03-13 11:56:24', 1, 1),
(9, 4, 39, 6, 'Michael Wilson', 'Third party consultant', '2026-03-13 11:56:24', '2026-03-13 11:56:24', 1, 1),
(10, 4, 40, 6, 'Emily Clark', 'Corporate third party', '2026-03-13 11:56:24', '2026-03-13 11:56:24', 1, 1),
(11, 5, 41, 5, 'David Thompson', 'Expert witness', '2026-03-13 11:56:24', '2026-03-13 11:56:24', 1, 1),
(12, 6, 42, 5, 'Laura Adams', 'Witness', '2026-03-13 11:56:24', '2026-03-13 11:56:24', 1, 1),
(13, 6, 43, 6, 'Smith & Co', 'Third party', '2026-03-13 11:56:24', '2026-03-13 11:56:24', 1, 1),
(14, 7, 44, 5, 'Nancy Lee', 'Witness', '2026-03-13 11:56:24', '2026-03-13 11:56:24', 1, 1),
(15, 7, 45, 5, 'Oliver King', 'Expert witness', '2026-03-13 11:56:24', '2026-03-13 11:56:24', 1, 1),
(16, 7, 46, 6, 'Global Solutions', 'Third party', '2026-03-13 11:56:24', '2026-03-13 11:56:24', 1, 1),
(17, 8, 47, 5, 'Victor Green', 'Witness', '2026-03-13 11:56:24', '2026-03-13 11:56:24', 1, 1),
(18, 8, 48, 5, 'Rachel Hall', 'Witness', '2026-03-13 11:56:24', '2026-03-13 11:56:24', 1, 1),
(19, 8, 49, 6, 'Steven Young', 'Third party', '2026-03-13 11:56:24', '2026-03-13 11:56:24', 1, 1),
(20, 8, 50, 6, 'Monica Scott', 'Third party', '2026-03-13 11:56:24', '2026-03-13 11:56:24', 1, 1),
(21, 9, 51, 5, 'Philip Allen', 'Witness', '2026-03-13 11:56:24', '2026-03-13 11:56:24', 1, 1),
(22, 10, 52, 5, 'Angela Baker', 'Expert witness', '2026-03-13 11:56:24', '2026-03-13 11:56:24', 1, 1),
(23, 10, 53, 6, 'TechCorp Ltd', 'Third party', '2026-03-13 11:56:24', '2026-03-13 11:56:24', 1, 1),
(24, 11, 54, 5, 'Brenda Foster', 'Witness', '2026-03-13 11:56:24', '2026-03-13 11:56:24', 1, 1),
(25, 11, 55, 5, 'Jason Hall', 'Witness', '2026-03-13 11:56:24', '2026-03-13 11:56:24', 1, 1),
(26, 11, 56, 6, 'Global Ventures', 'Third party', '2026-03-13 11:56:24', '2026-03-13 11:56:24', 1, 1),
(27, 12, 57, 5, 'Olivia Perez', 'Witness', '2026-03-13 11:56:24', '2026-03-13 11:56:24', 1, 1),
(28, 12, 58, 5, 'Kevin Morgan', 'Expert witness', '2026-03-13 11:56:24', '2026-03-13 11:56:24', 1, 1),
(29, 12, 59, 6, 'Daniel Reed', 'Third party', '2026-03-13 11:56:24', '2026-03-13 11:56:24', 1, 1),
(30, 12, 60, 6, 'Samantha Cox', 'Third party', '2026-03-13 11:56:24', '2026-03-13 11:56:24', 1, 1);

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

--
-- Table structure for table `case_priorities`
--

DROP TABLE IF EXISTS `case_priorities`;
CREATE TABLE IF NOT EXISTS `case_priorities` (
  `priority_id` int NOT NULL AUTO_INCREMENT,
  `priority_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `severity_rank` int NOT NULL,
  `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `is_active` tinyint(1) DEFAULT '1',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`priority_id`),
  UNIQUE KEY `priority_name` (`priority_name`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `case_priorities`
--

INSERT INTO `case_priorities` (`priority_id`, `priority_name`, `severity_rank`, `description`, `is_active`, `created_at`, `updated_at`) VALUES
(1, 'Low', 1, 'No immediate action required', 1, '2026-01-26 15:29:42', '2026-01-26 15:29:42'),
(2, 'Normal', 2, 'Standard case priority', 1, '2026-01-26 15:29:42', '2026-01-26 15:29:42'),
(3, 'Medium', 3, 'Requires attention but not urgent', 1, '2026-01-26 15:29:42', '2026-01-26 15:29:42'),
(4, 'High', 4, 'Time-sensitive case', 1, '2026-01-26 15:29:42', '2026-01-26 15:29:42'),
(5, 'Urgent', 5, 'Immediate action required', 1, '2026-01-26 15:29:42', '2026-01-26 15:29:42'),
(6, 'Critical', 6, 'Court-mandated or high-risk matter', 1, '2026-01-26 15:29:42', '2026-01-26 15:29:42');

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

--
-- Table structure for table `case_reasons`
--

DROP TABLE IF EXISTS `case_reasons`;
CREATE TABLE IF NOT EXISTS `case_reasons` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `reason_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `reason_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `reason_description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `created_by` bigint NOT NULL,
  `updated_by` bigint NOT NULL,
  `status` tinyint(1) NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`),
  KEY `fk_case_reasons_created_by` (`created_by`),
  KEY `fk_case_reasons_updated_by` (`updated_by`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `case_reasons`
--

INSERT INTO `case_reasons` (`id`, `reason_code`, `reason_name`, `reason_description`, `created_at`, `updated_at`, `created_by`, `updated_by`, `status`) VALUES
(1, 'CANCEL_DUP', 'Duplicate Case', 'The case was identified as a duplicate of an existing case and was therefore cancelled.', '2026-01-15 09:22:28', '2026-01-15 09:22:28', 1, 1, 0),
(2, 'CANCEL_REQ', 'Cancelled by Request', 'The case was cancelled following a formal request by the reporting party.', '2026-01-15 09:22:28', '2026-01-15 09:22:28', 1, 1, 0),
(3, 'CANCEL_INV', 'Invalid Case', 'The case did not meet the minimum criteria required for processing.', '2026-01-15 09:22:28', '2026-01-15 09:22:28', 1, 1, 1),
(4, 'CANCEL_ERR', 'Created in Error', 'The case was created due to a system or user error and has been cancelled.', '2026-01-15 09:22:28', '2026-01-19 11:44:25', 1, 1, 0),
(5, 'CANCEL_NOJ', 'No Jurisdiction', 'The case falls outside the organisation’s legal or operational jurisdiction.', '2026-01-15 09:22:28', '2026-01-15 09:22:28', 1, 1, 1),
(6, 'CANCEL_NEV', 'Insufficient Evidence', 'The case was cancelled due to a lack of supporting evidence.', '2026-01-15 09:22:28', '2026-01-15 09:22:28', 1, 1, 1),
(7, 'CANCEL_RES', 'Resolved Externally', 'The matter was resolved outside the system prior to case processing.', '2026-01-15 09:22:28', '2026-01-15 09:22:28', 1, 1, 1),
(8, 'CANCEL_NON', 'Non-Responsive Party', 'The involved party failed to respond within the required timeframe.', '2026-01-15 09:22:28', '2026-01-15 09:22:28', 1, 1, 1),
(9, 'CANCEL_WDR', 'Withdrawn by Initiator', 'The case was formally withdrawn by the individual who initiated it.', '2026-01-15 09:22:28', '2026-01-15 09:22:28', 1, 1, 1),
(10, 'CANCEL_POL', 'Policy Violation', 'The case conflicted with organisational policy and could not proceed.', '2026-01-15 09:22:28', '2026-01-15 09:22:28', 1, 1, 1);

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

--
-- Table structure for table `case_roles`
--

DROP TABLE IF EXISTS `case_roles`;
CREATE TABLE IF NOT EXISTS `case_roles` (
  `role_id` int NOT NULL AUTO_INCREMENT,
  `role_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `is_active` tinyint(1) DEFAULT '1',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `created_by` bigint UNSIGNED NOT NULL,
  `updated_by` bigint UNSIGNED NOT NULL,
  PRIMARY KEY (`role_id`),
  UNIQUE KEY `role_name` (`role_name`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `case_roles`
--

INSERT INTO `case_roles` (`role_id`, `role_name`, `description`, `is_active`, `created_at`, `updated_at`, `created_by`, `updated_by`) VALUES
(1, 'Plaintiff', 'Party initiating the case', 1, '2026-01-26 15:30:52', '2026-01-26 15:30:52', 0, 0),
(2, 'Defendant', 'Party responding to the case', 1, '2026-01-26 15:30:52', '2026-01-26 15:30:52', 0, 0),
(3, 'Applicant', 'Party applying for legal relief', 1, '2026-01-26 15:30:52', '2026-01-26 15:30:52', 0, 0),
(4, 'Respondent', 'Party responding to an application', 1, '2026-01-26 15:30:52', '2026-01-26 15:30:52', 0, 0),
(5, 'Witness', 'Individual providing testimony', 1, '2026-01-26 15:30:52', '2026-03-13 11:54:08', 0, 0),
(6, 'Third Party', 'External party involved in the case', 1, '2026-01-26 15:30:52', '2026-01-26 15:30:52', 0, 0),
(8, 'Co-Plaintiff', 'Co-plaintiff on the case', 1, '2026-03-13 12:00:46', '2026-03-13 12:00:46', 0, 0),
(9, 'Co-Defendant', 'Co-defendant on the case', 1, '2026-03-13 12:00:46', '2026-03-13 12:00:46', 0, 0);

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

--
-- Table structure for table `case_statuses`
--

DROP TABLE IF EXISTS `case_statuses`;
CREATE TABLE IF NOT EXISTS `case_statuses` (
  `status_code` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `status_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `status_description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `color_code` char(7) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `sort_order` int NOT NULL DEFAULT '0',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`status_code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `case_statuses`
--

INSERT INTO `case_statuses` (`status_code`, `status_name`, `status_description`, `color_code`, `is_active`, `sort_order`, `created_at`, `updated_at`) VALUES
('CLOS', 'Closed', 'Case has been concluded and formally closeddd', '#6C757D', 0, 3, '2026-01-16 14:07:34', '2026-01-22 06:16:40'),
('INTVN', 'Intervened', 'government intervention', '#6b7280', 1, 0, '2026-01-17 14:23:12', '2026-01-17 14:23:12'),
('OPEN', 'Open', 'Case is active and currently being handled', '#28A745', 0, 1, '2026-01-16 14:07:34', '2026-01-16 14:07:34'),
('PEND', 'Pending', 'Case is temporarily inactive or awaiting action', '#FFC107', 0, 2, '2026-01-16 14:07:34', '2026-01-16 14:07:34'),
('TRAN', 'Transferred', 'Case has been transferred to another firm or court', '#17A2B8', 0, 5, '2026-01-16 14:07:34', '2026-01-16 14:07:34'),
('WDTH', 'Withdrawn', 'Case was withdrawn by the client or counsel', '#DC3545', 0, 4, '2026-01-16 14:07:34', '2026-01-16 14:07:34');

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

--
-- Table structure for table `case_types`
--

DROP TABLE IF EXISTS `case_types`;
CREATE TABLE IF NOT EXISTS `case_types` (
  `type_id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `type_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `type_description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`type_id`),
  UNIQUE KEY `uq_case_types_type_name` (`type_name`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `case_types`
--

INSERT INTO `case_types` (`type_id`, `type_name`, `type_description`, `created_at`, `updated_at`) VALUES
(1, 'robbery', 'Illegal possession or taking of property using force or intimidations.', '2026-01-22 11:31:43', '2026-01-22 13:59:13'),
(2, 'assault', 'Physical attack causing bodily harm or threat thereof', '2026-01-22 11:31:43', '2026-01-22 11:31:43'),
(3, 'fraud', 'Deception intended to result in financial or personal gain', '2026-01-22 11:31:43', '2026-01-22 11:31:43'),
(4, 'burglary', 'Unlawful entry into a structure with intent to commit a crime', '2026-01-22 11:31:43', '2026-01-22 11:31:43'),
(5, 'theft', 'Unlawful taking of another person’s property without force', '2026-01-22 11:31:43', '2026-01-22 11:31:43'),
(6, 'homicide', 'Unlawful killing of another human being', '2026-01-22 11:31:43', '2026-01-22 11:31:43'),
(7, 'kidnapping', 'Unlawful abduction or detention of a person', '2026-01-22 11:31:43', '2026-01-22 11:31:43'),
(8, 'domestic_violence', 'Abuse or violence occurring within a domestic relationship', '2026-01-22 11:31:43', '2026-01-22 11:31:43'),
(9, 'drug_trafficking', 'Illegal manufacture, distribution, or sale of controlled substances', '2026-01-22 11:31:43', '2026-01-22 11:31:43'),
(10, 'money_laundering', 'Concealment of the origins of illegally obtained money', '2026-01-22 11:31:43', '2026-01-22 11:31:43'),
(11, 'cybercrime', 'Criminal activities carried out using computers or digital networksss', '2026-01-22 11:31:43', '2026-01-22 13:53:16');

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

--
-- Table structure for table `cashbooks`
--

DROP TABLE IF EXISTS `cashbooks`;
CREATE TABLE IF NOT EXISTS `cashbooks` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `account_number` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `gl_account_id` bigint UNSIGNED NOT NULL,
  `is_trust` tinyint(1) NOT NULL DEFAULT '0',
  `currency` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'USD',
  `created_by` bigint UNSIGNED DEFAULT NULL,
  `updated_by` bigint UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `cashbooks_created_by_foreign` (`created_by`),
  KEY `cashbooks_updated_by_foreign` (`updated_by`),
  KEY `cashbooks_gl_account_id_index` (`gl_account_id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `cashbooks`
--

INSERT INTO `cashbooks` (`id`, `name`, `account_number`, `gl_account_id`, `is_trust`, `currency`, `created_by`, `updated_by`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 'Cash USD', '1001-002-847361', 18, 0, 'USD', 1, 1, '2026-04-01 08:22:05', '2026-04-01 08:22:05', NULL),
(2, 'Petty Cash USD', '1001-002-847362', 17, 0, 'USD', 1, 1, '2026-04-01 08:22:05', '2026-04-01 08:22:05', NULL),
(3, 'Trust Account - Cash USD', '1001-009-554821', 22, 1, 'CUR001', 1, 1, '2026-04-01 08:22:05', '2026-04-01 13:31:54', NULL),
(4, 'Trust Account - Petty Cash USD', '1001-009-554822', 23, 1, 'USD', 1, 1, '2026-04-01 08:22:05', '2026-04-01 08:22:05', NULL),
(5, 'Trust Account - Trade Receivable', '1001-009-554823', 24, 1, 'USD', 1, 1, '2026-04-01 08:22:05', '2026-04-01 08:22:05', NULL);

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

--
-- Table structure for table `chat_groups`
--

DROP TABLE IF EXISTS `chat_groups`;
CREATE TABLE IF NOT EXISTS `chat_groups` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `group_name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `group_description` text COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `group_name` (`group_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `chat_messages`
--

DROP TABLE IF EXISTS `chat_messages`;
CREATE TABLE IF NOT EXISTS `chat_messages` (
  `message_id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `chat_id` bigint UNSIGNED NOT NULL,
  `sender_id` bigint UNSIGNED NOT NULL,
  `updated_by` bigint UNSIGNED DEFAULT NULL,
  `message_type` enum('text','file','audio','video','call','notification') COLLATE utf8mb4_unicode_ci DEFAULT 'text',
  `message` text COLLATE utf8mb4_unicode_ci,
  `file_id` bigint UNSIGNED DEFAULT NULL,
  `call_type` enum('audio','video') COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `call_status` enum('missed','answered','declined') COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `is_read` tinyint(1) DEFAULT '0',
  `is_deleted` tinyint(1) DEFAULT '0',
  `sent_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `read_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`message_id`),
  KEY `chat_id` (`chat_id`),
  KEY `sender_id` (`sender_id`),
  KEY `file_id` (`file_id`),
  KEY `chat_messages_updated_by_index` (`updated_by`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `chat_messages`
--

INSERT INTO `chat_messages` (`message_id`, `chat_id`, `sender_id`, `updated_by`, `message_type`, `message`, `file_id`, `call_type`, `call_status`, `is_read`, `is_deleted`, `sent_at`, `read_at`, `deleted_at`) VALUES
(1, 1, 1, NULL, 'text', 'hello', NULL, NULL, NULL, 1, 0, '2026-03-14 16:18:07', '2026-03-14 14:18:17', NULL),
(2, 1, 1, NULL, 'text', 'hello', NULL, NULL, NULL, 1, 0, '2026-03-15 09:07:11', '2026-03-15 07:08:04', NULL),
(3, 1, 1, NULL, 'text', 'hello', NULL, NULL, NULL, 1, 0, '2026-03-15 09:07:14', '2026-03-15 07:08:04', NULL),
(4, 1, 1, NULL, 'text', 'hi', NULL, NULL, NULL, 1, 0, '2026-03-15 09:20:22', '2026-03-15 07:20:28', NULL),
(5, 1, 1, NULL, 'text', 'good mornign', NULL, NULL, NULL, 1, 0, '2026-03-15 07:27:46', '2026-03-15 07:27:49', NULL),
(6, 1, 1, NULL, 'text', 'hello', NULL, NULL, NULL, 1, 0, '2026-03-15 07:48:05', '2026-03-15 07:48:20', NULL),
(7, 1, 2, NULL, 'text', 'im good', NULL, NULL, NULL, 1, 0, '2026-03-15 07:48:25', '2026-03-15 07:48:27', NULL),
(8, 1, 2, NULL, 'text', 'hi', NULL, NULL, NULL, 1, 0, '2026-03-15 08:03:23', '2026-03-15 08:14:59', NULL),
(9, 1, 1, NULL, 'text', 'hi', NULL, NULL, NULL, 1, 0, '2026-03-15 08:03:57', '2026-03-15 08:15:00', NULL),
(10, 1, 2, NULL, 'text', 'good', NULL, NULL, NULL, 1, 0, '2026-03-15 08:17:17', '2026-03-15 08:17:21', NULL),
(11, 1, 2, NULL, 'text', 'whos james', NULL, NULL, NULL, 1, 0, '2026-03-15 08:17:31', '2026-03-15 08:17:31', NULL),
(12, 1, 2, NULL, 'text', 'why is the long.', NULL, NULL, NULL, 1, 0, '2026-03-15 13:35:37', '2026-03-15 13:35:57', NULL),
(13, 1, 1, NULL, 'text', 'what 😂😂 whats a long', NULL, NULL, NULL, 1, 0, '2026-03-15 13:36:11', '2026-03-15 13:36:13', NULL);

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

--
-- Table structure for table `chat_participants`
--

DROP TABLE IF EXISTS `chat_participants`;
CREATE TABLE IF NOT EXISTS `chat_participants` (
  `participant_id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `chat_id` bigint UNSIGNED NOT NULL,
  `user_id` bigint UNSIGNED NOT NULL,
  `updated_by` bigint UNSIGNED DEFAULT NULL,
  `role` enum('member','admin','owner') COLLATE utf8mb4_unicode_ci DEFAULT 'member',
  `joined_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `last_seen` timestamp NULL DEFAULT NULL,
  `is_muted` tinyint(1) DEFAULT '0',
  `is_blocked` tinyint(1) DEFAULT '0',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`participant_id`),
  UNIQUE KEY `chat_participants_chat_id_user_id_unique` (`chat_id`,`user_id`),
  KEY `chat_id` (`chat_id`),
  KEY `user_id` (`user_id`),
  KEY `chat_participants_updated_by_index` (`updated_by`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `chat_participants`
--

INSERT INTO `chat_participants` (`participant_id`, `chat_id`, `user_id`, `updated_by`, `role`, `joined_at`, `last_seen`, `is_muted`, `is_blocked`, `created_at`, `updated_at`) VALUES
(1, 1, 1, NULL, 'member', '2026-03-14 14:12:19', '2026-04-07 06:13:24', 0, 0, NULL, '2026-03-15 07:36:04'),
(2, 1, 2, NULL, 'member', '2026-03-14 14:12:19', '2026-03-15 14:36:18', 0, 0, NULL, '2026-03-15 07:36:23'),
(3, 2, 1, NULL, 'member', '2026-03-15 08:17:01', '2026-04-07 06:13:24', 0, 0, NULL, NULL),
(4, 2, 3, NULL, 'member', '2026-03-15 08:17:01', '2026-03-15 08:17:01', 0, 0, NULL, NULL);

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

--
-- Table structure for table `chat_passcodes`
--

DROP TABLE IF EXISTS `chat_passcodes`;
CREATE TABLE IF NOT EXISTS `chat_passcodes` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `user_id` bigint UNSIGNED NOT NULL,
  `passcode_hash` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `is_active` tinyint(1) DEFAULT '1',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `created_by` bigint UNSIGNED DEFAULT NULL,
  `updated_by` bigint UNSIGNED DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `unique_user_passcode` (`user_id`),
  KEY `idx_created_by` (`created_by`),
  KEY `idx_updated_by` (`updated_by`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `chat_passcodes`
--

INSERT INTO `chat_passcodes` (`id`, `user_id`, `passcode_hash`, `is_active`, `created_at`, `updated_at`, `created_by`, `updated_by`) VALUES
(1, 1, '$2y$12$o5.dUYztKamaPICUqGih9.XooUXlRopUjp59Xsc9B4uDSRmUoEtgW', 1, '2026-03-07 07:38:26', '2026-03-14 14:48:56', 1, 1),
(2, 2, '$2y$12$.kgRbXABDMvcq/4Dk5DH..srnIM2AwmCNSqBc7Dk17TNJgzikPJ42', 1, '2026-03-07 07:38:26', '2026-03-07 07:38:26', 2, 2),
(3, 3, '$2y$12$zmNnoCbUr.kDXZyQaxD/Q.scDbkIjPlRnv/mw40vD3yz8hmebpW2C', 1, '2026-03-07 07:38:27', '2026-03-07 07:38:27', 3, 3),
(4, 4, '$2y$12$GPFwPttkLWF1Bn0O/FGJW.JUtB5IUmlgJwoDlVTrlQLwJz5C3kdba', 1, '2026-03-07 07:38:27', '2026-03-07 07:38:27', 4, 4),
(5, 5, '$2y$12$35Jtlz8ePuokkg0L93I0LOFCE/tlbpPpkpSWCHgbb7KYTKHzAXk2C', 1, '2026-03-07 07:38:28', '2026-03-07 07:38:28', 5, 5),
(6, 6, '$2y$12$A4v./8.iv9mfbONGbP6eBezpzVEjz1H7h9nJiJbMEBm6tAMxFRzRa', 1, '2026-03-07 07:38:28', '2026-03-07 07:38:28', 6, 6),
(7, 7, '$2y$12$NyEarXfDOVOA6xDfIZPSk.ifmdo3wYTvt4BUkmjcrK6L0K6uXUnTu', 1, '2026-03-07 07:38:29', '2026-03-07 07:38:29', 7, 7);

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

--
-- Table structure for table `chat_requests`
--

DROP TABLE IF EXISTS `chat_requests`;
CREATE TABLE IF NOT EXISTS `chat_requests` (
  `request_id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `sender_id` bigint UNSIGNED NOT NULL,
  `receiver_id` bigint UNSIGNED NOT NULL,
  `updated_by` bigint UNSIGNED DEFAULT NULL,
  `status` enum('pending','accepted','rejected') COLLATE utf8mb4_unicode_ci DEFAULT 'pending',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `responded_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`request_id`),
  KEY `sender_id` (`sender_id`),
  KEY `receiver_id` (`receiver_id`),
  KEY `chat_requests_sender_id_receiver_id_index` (`sender_id`,`receiver_id`),
  KEY `chat_requests_updated_by_index` (`updated_by`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `chat_rooms`
--

DROP TABLE IF EXISTS `chat_rooms`;
CREATE TABLE IF NOT EXISTS `chat_rooms` (
  `chat_id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `chat_type` enum('private','group') COLLATE utf8mb4_unicode_ci DEFAULT 'private',
  `group_name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `group_description` text COLLATE utf8mb4_unicode_ci,
  `group_avatar_url` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_by` bigint UNSIGNED NOT NULL,
  `updated_by` bigint UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `last_message_id` bigint UNSIGNED DEFAULT NULL,
  `is_active` tinyint(1) DEFAULT '1',
  `deleted_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`chat_id`),
  KEY `created_by` (`created_by`),
  KEY `last_message_id` (`last_message_id`),
  KEY `chat_rooms_updated_by_foreign` (`updated_by`),
  KEY `chat_rooms_created_by_updated_by_index` (`created_by`,`updated_by`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `chat_rooms`
--

INSERT INTO `chat_rooms` (`chat_id`, `chat_type`, `group_name`, `group_description`, `group_avatar_url`, `created_by`, `updated_by`, `created_at`, `updated_at`, `last_message_id`, `is_active`, `deleted_at`) VALUES
(1, 'private', NULL, NULL, NULL, 1, NULL, '2026-03-14 14:12:19', '2026-03-15 13:36:11', 13, 1, NULL),
(2, 'private', NULL, NULL, NULL, 1, NULL, '2026-03-15 08:17:01', '2026-03-15 08:17:01', NULL, 1, NULL);

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

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

DROP TABLE IF EXISTS `clients`;
CREATE TABLE IF NOT EXISTS `clients` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `client_id` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL,
  `first_name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `last_name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `national_id` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `date_of_birth` date DEFAULT NULL,
  `gender` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `phone_primary` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `email` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `street_address` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `city` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `state_province` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `country` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `employer_name` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `position_role` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `client_type` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `client_category` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `date_onboarded` date DEFAULT NULL,
  `assigned_lawyer` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `referred_lawyer` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `notes` text COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `client_id` (`client_id`),
  UNIQUE KEY `national_id` (`national_id`)
) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `clients` (`id`, `client_id`, `first_name`, `last_name`, `national_id`, `date_of_birth`, `gender`, `phone_primary`, `email`, `street_address`, `city`, `state_province`, `country`, `employer_name`, `position_role`, `client_type`, `client_category`, `date_onboarded`, `assigned_lawyer`, `referred_lawyer`, `notes`, `created_at`, `updated_at`) VALUES
(1, 'CL-0001', 'James', 'Whitaker', 'ZW123456A', '1985-03-14', 'Male', '+263771234567', 'james.whitaker@example.com', '12 Samora Machel Ave', 'Harare', 'Harare Province', 'Zimbabwe', 'Whitaker Holdings', 'Managing Director', NULL, NULL, '2024-01-10', 'L940147', 'L200861', 'Corporate compliance advisory', '2026-01-06 10:29:08', '2026-01-06 12:44:40'),
(2, 'CL-0002', 'Emily', 'Carter', 'ZW654321B', '1990-07-22', 'Female', '+263772345678', 'emily.carter@example.com', '45 Borrowdale Road', 'Harare', 'Harare Province', 'Zimbabwe', 'Carter & Co', 'Legal Consultant', 'Individual', 'Professional', '2024-01-15', 'Adv. Ncube', NULL, 'Contract review services', '2026-01-06 10:29:08', '2026-01-06 10:29:08'),
(3, 'CL-0003', 'Michael', 'Dube', 'ZW789456C', '1978-11-05', 'Male', '+263773456789', 'michael.dube@example.com', '89 Main Street', 'Bulawayo', 'Bulawayo Province', 'Zimbabwe', 'Dube Logistics', 'Operations Manager', 'Individual', 'Commercial', '2024-02-01', 'Adv. Sibanda', 'Adv. Moyo', 'Ongoing litigation support', '2026-01-06 10:29:08', '2026-01-06 10:29:08'),
(5, 'CL-0005', 'Daniel', 'Mukasa', 'ZW456789E', '1983-09-30', 'Male', '+263775678901', 'daniel.mukasa@example.com', '101 Airport Road', 'Gweru', 'Midlands Province', 'Zimbabwe', 'Mukasa Engineering', 'Senior Engineer', NULL, NULL, '2024-02-20', 'L200861', 'L940147', 'Regulatory and safety compliance', '2026-01-06 10:29:08', '2026-01-06 12:43:58'),
(8, 'CL001', 'Tendai', 'Moyo', '63-123456-A-63', '1988-04-12', 'Male', '+263772345678', 'tendai.moyo@email.com', '12 Samora Machel Ave', 'Harare', 'Harare', 'Zimbabwe', 'Econet Wireless', 'Network Technician', 'Individual', 'Corporate', '2024-01-15', 'L940147', 'L200861', 'Corporate client onboarding', '2026-01-31 11:13:20', '2026-01-31 11:13:20'),
(9, 'CL002', 'Rudo', 'Chikore', '08-654321-B-08', '1992-09-30', 'Female', '+263773456789', 'rudo.chikore@email.com', '45 Jason Moyo St', 'Bulawayo', 'Bulawayo', 'Zimbabwe', 'NSSA', 'HR Officer', 'Individual', 'Labour', '2024-01-18', 'L940147', 'L200861', 'Labour dispute consultation', '2026-01-31 11:13:20', '2026-01-31 11:13:20'),
(10, 'CL003', 'Farai', 'Dube', '75-112233-C-75', '1985-06-05', 'Male', '+263774567890', 'farai.dube@email.com', '89 Herbert Chitepo Rd', 'Mutare', 'Manicaland', 'Zimbabwe', 'ZimPower', 'Electrical Engineer', 'Individual', 'Energy', '2024-01-20', 'L940147', 'L200861', 'Regulatory compliance case', '2026-01-31 11:13:20', '2026-01-31 11:13:20'),
(11, 'CL004', 'Chipo', 'Sibanda', '02-998877-D-02', '1990-11-21', 'Female', '+263775678901', 'chipo.sibanda@email.com', '23 Josiah Tongogara St', 'Gweru', 'Midlands', 'Zimbabwe', 'Delta Beverages', 'Sales Manager', 'Individual', 'Commercial', '2024-01-22', 'L940147', 'L200861', 'Commercial contract review', '2026-01-31 11:13:20', '2026-01-31 11:13:20'),
(12, 'CL005', 'Blessing', 'Ndlovu', '12-445566-E-12', '1983-02-14', 'Male', '+263776789012', 'blessing.ndlovu@email.com', '7 Main Street', 'Victoria Falls', 'Matabeleland North', 'Zimbabwe', 'Victoria Falls Safari Lodge', 'Operations Manager', 'Individual', 'Hospitality', '2024-01-25', 'L940147', 'L200861', 'Hospitality licensing matter', '2026-01-31 11:13:20', '2026-01-31 11:13:20'),
(13, 'CL006', 'Memory', 'Zhou', '44-778899-F-44', '1995-07-19', 'Female', '+263777890123', 'memory.zhou@email.com', '101 Enterprise Rd', 'Harare', 'Harare', 'Zimbabwe', 'CBZ Bank', 'Account Analyst', 'Individual', 'Finance', '2024-01-27', 'L940147', 'L200861', 'Banking dispute advisory', '2026-01-31 11:13:20', '2026-01-31 11:13:20'),
(14, 'CL007', 'Simba', 'Katsande', '19-334455-G-19', '1987-03-08', 'Male', '+263778901234', 'simba.katsande@email.com', '55 Mkoba Rd', 'Gweru', 'Midlands', 'Zimbabwe', 'Local Authority', 'Procurement Officer', 'Individual', 'Public Sector', '2024-01-29', 'L940147', 'L200861', 'Tender review assistance', '2026-01-31 11:13:20', '2026-01-31 11:13:20'),
(15, 'CL008', 'Nyasha', 'Mukandi', '60-221144-H-60', '1998-12-02', 'Female', '+263779012345', 'nyasha.mukandi@email.com', '18 Chiremba Rd', 'Masvingo', 'Masvingo', 'Zimbabwe', 'Great Zimbabwe University', 'Research Assistant', 'Individual', 'Education', '2024-02-01', 'L940147', 'L200861', 'Student contract matter', '2026-01-31 11:13:20', '2026-01-31 11:13:20'),
(16, 'CL009', 'Tawanda', 'Mapfumo', '71-556677-J-71', '1981-08-27', 'Male', '+263771123456', 'tawanda.mapfumo@email.com', '33 Robert Mugabe Way', 'Kadoma', 'Mashonaland West', 'Zimbabwe', 'RioZim', 'Mine Supervisor', 'Individual', 'Mining', '2024-02-03', 'L940147', 'L200861', 'Mining compliance case', '2026-01-31 11:13:20', '2026-01-31 11:13:20'),
(17, 'CL010', 'Rutendo', 'Goronga', '25-889900-K-25', '1993-05-16', 'Female', '+263772234567', 'rutendo.goronga@email.com', '9 Kwekwe Rd', 'Kwekwe', 'Midlands', 'Zimbabwe', 'Private Practice', 'Consultant', 'Individual', 'Civil', '2024-02-05', 'L940147', 'L200861', 'Civil litigation support', '2026-01-31 11:13:20', '2026-01-31 11:13:20'),
(18, 'CL1870787', 'Herr', 'Gwena', 'AE224400', '1967-02-01', 'Male', '+263 889 1123 222', 'herr@wasser.com', '0910 Reichshouse street', 'Berlin', 'Berlin', 'Germany', 'Gwena AG', 'CFO', 'IND', 'HNWI', '2009-08-04', NULL, NULL, NULL, '2026-03-23 08:58:40', '2026-03-23 08:58:40'),
(19, 'CL011', 'Tatenda', 'Chirwa', '63-445566-L-63', '1991-04-18', 'Male', '+263773112233', 'tatenda.chirwa@email.com', '14 First Street', 'Harare', 'Harare', 'Zimbabwe', 'ZB Bank', 'Credit Officer', 'Individual', 'Finance', '2024-02-07', 'L940147', 'L200861', 'Loan agreement advisory', '2026-03-27 04:54:26', '2026-03-27 04:54:26'),
(20, 'CL012', 'Lindiwe', 'Ncube', '08-778899-M-08', '1986-09-12', 'Female', '+263774223344', 'lindiwe.ncube@email.com', '22 Lobengula St', 'Bulawayo', 'Bulawayo', 'Zimbabwe', 'OK Zimbabwe', 'Store Manager', 'Individual', 'Retail', '2024-02-10', 'L940147', 'L200861', 'Retail lease agreement review', '2026-03-27 04:54:26', '2026-03-27 04:54:26'),
(21, 'CL013', 'Kudakwashe', 'Banda', '12-334455-N-12', '1994-01-25', 'Male', '+263775334455', 'kuda.banda@email.com', '5 Chinhoyi Rd', 'Chinhoyi', 'Mashonaland West', 'Zimbabwe', 'ZESA', 'Technician', 'Individual', 'Energy', '2024-02-12', 'L940147', 'L200861', 'Employment contract dispute', '2026-03-27 04:54:26', '2026-03-27 04:54:26'),
(22, 'CL014', 'Tsitsi', 'Muchengeti', '44-667788-P-44', '1989-06-30', 'Female', '+263776445566', 'tsitsi.muchengeti@email.com', '78 Sam Nujoma St', 'Harare', 'Harare', 'Zimbabwe', 'Ministry of Health', 'Nurse', 'Individual', 'Public Sector', '2024-02-14', 'L940147', 'L200861', 'Workplace grievance case', '2026-03-27 04:54:26', '2026-03-27 04:54:26'),
(23, 'CL015', 'Elvis', 'Madondo', '19-998877-Q-19', '1982-11-11', 'Male', '+263777556677', 'elvis.madondo@email.com', '3 Industrial Rd', 'Kwekwe', 'Midlands', 'Zimbabwe', 'ZISCO Steel', 'Foreman', 'Individual', 'Industrial', '2024-02-16', 'L940147', 'L200861', 'Industrial safety compliance', '2026-03-27 04:54:26', '2026-03-27 04:54:26'),
(24, 'CL016', 'Rumbidzai', 'Chinoda', '60-112244-R-60', '1996-03-09', 'Female', '+263778667788', 'rumbi.chinoda@email.com', '44 Mutare Rd', 'Mutare', 'Manicaland', 'Zimbabwe', 'Steward Bank', 'Customer Service Rep', 'Individual', 'Finance', '2024-02-18', 'L940147', 'L200861', 'Customer dispute resolution', '2026-03-27 04:54:26', '2026-03-27 04:54:26'),
(25, 'CL017', 'Brian', 'Zhou', '71-556600-S-71', '1984-07-21', 'Male', '+263779778899', 'brian.zhou@email.com', '12 Enterprise Rd', 'Harare', 'Harare', 'Zimbabwe', 'ZimTrade', 'Export Officer', 'Individual', 'Trade', '2024-02-20', 'L940147', 'L200861', 'Export compliance advisory', '2026-03-27 04:54:26', '2026-03-27 04:54:26'),
(26, 'CL018', 'Faith', 'Makoni', '25-334411-T-25', '1993-10-05', 'Female', '+263771889900', 'faith.makoni@email.com', '67 Josiah Tongogara Ave', 'Masvingo', 'Masvingo', 'Zimbabwe', 'Teacher Service Commission', 'Teacher', 'Individual', 'Education', '2024-02-22', 'L940147', 'L200861', 'Employment contract clarification', '2026-03-27 04:54:26', '2026-03-27 04:54:26'),
(27, 'CL019', 'Percy', 'Ndlovu', '02-778811-U-02', '1980-05-17', 'Male', '+263772990011', 'percy.ndlovu@email.com', '88 Main Rd', 'Victoria Falls', 'Matabeleland North', 'Zimbabwe', 'Tourism Authority', 'Tour Guide', 'Individual', 'Tourism', '2024-02-24', 'L940147', 'L200861', 'Tourism licensing issue', '2026-03-27 04:54:26', '2026-03-27 04:54:26'),
(28, 'CL020', 'Shamiso', 'Gumbo', '75-223344-V-75', '1997-12-28', 'Female', '+263773001122', 'shamiso.gumbo@email.com', '29 Borrowdale Brooke', 'Harare', 'Harare', 'Zimbabwe', 'Startup Hub', 'Entrepreneur', 'Individual', 'Startup', '2024-02-26', 'L940147', 'L200861', 'Business registration advisory', '2026-03-27 04:54:26', '2026-03-27 04:54:26');

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

--
-- Table structure for table `client_categories`
--

DROP TABLE IF EXISTS `client_categories`;
CREATE TABLE IF NOT EXISTS `client_categories` (
  `category_id` int NOT NULL AUTO_INCREMENT,
  `category_code` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
  `category_description` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`category_id`),
  UNIQUE KEY `category_code` (`category_code`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `client_categories`
--

INSERT INTO `client_categories` (`category_id`, `category_code`, `category_description`, `created_at`, `updated_at`) VALUES
(1, 'INDIV', 'Individual private clients seeking personal legal services', '2026-01-06 14:54:30', '2026-01-06 14:54:30'),
(2, 'HNWI', 'High-net-worth individuals requiring complex legal and tax advisory services', '2026-01-06 14:54:30', '2026-01-06 14:54:30'),
(3, 'SME', 'Small and medium-sized enterprises including startups and owner-managed businesses', '2026-01-06 14:54:30', '2026-01-06 14:54:30'),
(4, 'CORP', 'Large corporations and multinational companies', '2026-01-06 14:54:30', '2026-01-06 14:54:30'),
(5, 'FIN', 'Financial institutions such as banks, insurers, and investment firms', '2026-01-06 14:54:30', '2026-01-06 14:54:30'),
(6, 'GOV', 'Government bodies, public authorities, and state-owned entities', '2026-01-06 14:54:30', '2026-01-06 14:54:30'),
(7, 'NONP', 'Non-profit organizations, charities, and foundations', '2026-01-06 14:54:30', '2026-01-06 14:54:30'),
(8, 'PROF', 'Professional services firms including accountants, consultants, and medical practices', '2026-01-06 14:54:30', '2026-01-06 14:54:30'),
(9, 'REF', 'Referral-based clients introduced by third parties or panel arrangements', '2026-01-06 14:54:30', '2026-01-06 14:54:30'),
(10, 'PROB', 'Pro bono and strategic clients taken on for public interest or reputational purposes', '2026-01-06 14:54:30', '2026-01-06 14:54:30');

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

--
-- Table structure for table `client_invoices`
--

DROP TABLE IF EXISTS `client_invoices`;
CREATE TABLE IF NOT EXISTS `client_invoices` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `invoice_number` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `invoice_date` date NOT NULL,
  `due_date` date DEFAULT NULL,
  `client_id` bigint UNSIGNED NOT NULL COMMENT 'FK → clients.id',
  `matter_id` bigint UNSIGNED DEFAULT NULL,
  `case_id` bigint UNSIGNED DEFAULT NULL,
  `case_reference` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `responsible_lawyer` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'FK → lawyers.lawyer_id',
  `quotation_id` bigint UNSIGNED DEFAULT NULL COMMENT 'FK → client_quotations.id if converted from quotation',
  `arrangement_id` bigint UNSIGNED DEFAULT NULL COMMENT 'FK → fee_arrangements.arrangement_id',
  `billing_period_from` date DEFAULT NULL,
  `billing_period_to` date DEFAULT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `narration` text COLLATE utf8mb4_unicode_ci,
  `gl_account` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `currency_id` bigint UNSIGNED NOT NULL,
  `subtotal` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT 'Sum of invoice lines before tax and disbursements',
  `disbursement_total` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT 'Sum of client_invoice_disbursements',
  `discount_total` decimal(12,2) NOT NULL DEFAULT '0.00',
  `tax_total` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT 'Sum of client_invoice_taxes',
  `total` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT 'subtotal + disbursement_total − discount_total + tax_total',
  `amount_paid` decimal(12,2) NOT NULL DEFAULT '0.00',
  `balance_due` decimal(12,2) GENERATED ALWAYS AS ((`total` - `amount_paid`)) STORED,
  `status` enum('draft','sent','partial','paid','overdue','cancelled','written_off') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'draft',
  `sent_at` timestamp NULL DEFAULT NULL,
  `paid_at` timestamp NULL DEFAULT NULL,
  `created_by` bigint UNSIGNED DEFAULT NULL,
  `updated_by` bigint UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uq_invoice_number` (`invoice_number`),
  KEY `idx_inv_client` (`client_id`),
  KEY `idx_inv_matter` (`matter_id`),
  KEY `idx_inv_case` (`case_id`),
  KEY `idx_inv_lawyer` (`responsible_lawyer`),
  KEY `idx_inv_status` (`status`),
  KEY `idx_inv_date` (`invoice_date`),
  KEY `idx_inv_currency` (`currency_id`),
  KEY `idx_inv_quotation` (`quotation_id`),
  KEY `idx_inv_arrangement` (`arrangement_id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Client invoice header. Lines in client_invoice_lines. Tax in client_invoice_taxes. Disbursements in client_invoice_disbursements.';

--
-- Dumping data for table `client_invoices`
--

INSERT INTO `client_invoices` (`id`, `invoice_number`, `invoice_date`, `due_date`, `client_id`, `matter_id`, `case_id`, `case_reference`, `responsible_lawyer`, `quotation_id`, `arrangement_id`, `billing_period_from`, `billing_period_to`, `description`, `narration`, `gl_account`, `currency_id`, `subtotal`, `disbursement_total`, `discount_total`, `tax_total`, `total`, `amount_paid`, `status`, `sent_at`, `paid_at`, `created_by`, `updated_by`, `created_at`, `updated_at`) VALUES
(1, 'INV-001', '2026-01-15', '2026-02-14', 1, 101, NULL, NULL, '1', NULL, 1, NULL, NULL, NULL, NULL, NULL, 1, 281.25, 0.00, 0.00, 42.19, 323.44, 150.00, 'partial', NULL, NULL, NULL, NULL, '2026-03-27 06:17:34', '2026-03-27 06:17:34'),
(2, 'INV-002', '2026-01-16', '2026-01-30', 2, 102, NULL, NULL, '2', 1, 2, NULL, NULL, NULL, NULL, NULL, 1, 1200.00, 0.00, 0.00, 180.00, 1380.00, 0.00, 'sent', NULL, NULL, NULL, NULL, '2026-03-27 06:18:40', '2026-03-27 06:18:40');

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

--
-- Table structure for table `client_invoice_disbursements`
--

DROP TABLE IF EXISTS `client_invoice_disbursements`;
CREATE TABLE IF NOT EXISTS `client_invoice_disbursements` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `invoice_id` bigint UNSIGNED NOT NULL COMMENT 'FK → client_invoices.id',
  `gl_account_id` bigint UNSIGNED DEFAULT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `disbursement_date` date DEFAULT NULL,
  `supplier` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Who the firm paid e.g. High Court Registrar',
  `receipt_reference` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'External receipt or proof-of-payment reference',
  `amount` decimal(12,2) NOT NULL DEFAULT '0.00',
  `is_taxable` tinyint(1) NOT NULL DEFAULT '0',
  `tax_rate` decimal(5,2) NOT NULL DEFAULT '0.00',
  `tax_amount` decimal(12,2) NOT NULL DEFAULT '0.00',
  `total_amount` decimal(12,2) GENERATED ALWAYS AS ((`amount` + `tax_amount`)) STORED,
  `created_by` bigint UNSIGNED DEFAULT NULL,
  `updated_by` bigint UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_disb_invoice` (`invoice_id`),
  KEY `client_invoice_disbursements_gl_account_id_index` (`gl_account_id`)
) ;

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

--
-- Table structure for table `client_invoice_gl_accounts`
--

DROP TABLE IF EXISTS `client_invoice_gl_accounts`;
CREATE TABLE IF NOT EXISTS `client_invoice_gl_accounts` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `invoice_id` bigint UNSIGNED NOT NULL,
  `gl_account_id` bigint UNSIGNED DEFAULT NULL,
  `gl_account_code` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `line_type` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `amount` decimal(18,2) NOT NULL DEFAULT '0.00',
  `created_by` bigint UNSIGNED DEFAULT NULL,
  `updated_by` bigint UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `client_invoice_gl_accounts_invoice_id_gl_account_id_index` (`invoice_id`,`gl_account_id`),
  KEY `client_invoice_gl_accounts_invoice_id_index` (`invoice_id`),
  KEY `client_invoice_gl_accounts_gl_account_id_index` (`gl_account_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `client_invoice_lines`
--

DROP TABLE IF EXISTS `client_invoice_lines`;
CREATE TABLE IF NOT EXISTS `client_invoice_lines` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `invoice_id` bigint UNSIGNED NOT NULL COMMENT 'FK → client_invoices.id',
  `charge_type` enum('FIXED_FEE','HOURLY','PER_APPEARANCE','RETAINER_DRAW','ADJUSTMENT') COLLATE utf8mb4_unicode_ci NOT NULL,
  `tariff_id` int DEFAULT NULL COMMENT 'FK → tariffs — NULL for free-text lines',
  `arrangement_id` bigint UNSIGNED DEFAULT NULL COMMENT 'FK → fee_arrangements',
  `service_code` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `service_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `billing_method` enum('FIXED_FEE','HOURLY','PER_APPEARANCE','PER_STAGE','RETAINER_PLUS','CONTINGENCY','SUBSCRIPTION') COLLATE utf8mb4_unicode_ci NOT NULL,
  `rate_snapshot` decimal(12,2) NOT NULL COMMENT 'CRITICAL: rate at time of billing. Never update. Allows audit of "what rate was charged on this date."',
  `billing_increment` int NOT NULL DEFAULT '60' COMMENT 'Snapshot of tariffs.billing_increment',
  `lawyer_id` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'The lawyer whose work this line charges',
  `work_date_from` date DEFAULT NULL,
  `work_date_to` date DEFAULT NULL,
  `total_raw_minutes` int NOT NULL DEFAULT '0',
  `total_rounded_minutes` int NOT NULL DEFAULT '0',
  `hours_decimal` decimal(8,4) GENERATED ALWAYS AS (round((`total_rounded_minutes` / 60.0),4)) STORED,
  `quantity` decimal(10,4) NOT NULL DEFAULT '1.0000',
  `base_amount` decimal(12,2) NOT NULL DEFAULT '0.00',
  `discount_pct` decimal(5,2) NOT NULL DEFAULT '0.00',
  `discount_amount` decimal(12,2) NOT NULL DEFAULT '0.00',
  `line_total` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT 'base_amount − discount_amount. Tax added at invoice level.',
  `description` text COLLATE utf8mb4_unicode_ci COMMENT 'Client-facing narrative for this charge line',
  `sort_order` int NOT NULL DEFAULT '0',
  `created_by` bigint UNSIGNED DEFAULT NULL,
  `updated_by` bigint UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_cil_invoice` (`invoice_id`),
  KEY `idx_cil_tariff` (`tariff_id`),
  KEY `idx_cil_lawyer` (`lawyer_id`),
  KEY `idx_cil_charge_type` (`charge_type`),
  KEY `idx_cil_arrangement` (`arrangement_id`)
) ;

--
-- Dumping data for table `client_invoice_lines`
--

INSERT INTO `client_invoice_lines` (`id`, `invoice_id`, `charge_type`, `tariff_id`, `arrangement_id`, `service_code`, `service_name`, `billing_method`, `rate_snapshot`, `billing_increment`, `lawyer_id`, `work_date_from`, `work_date_to`, `total_raw_minutes`, `total_rounded_minutes`, `quantity`, `base_amount`, `discount_pct`, `discount_amount`, `line_total`, `description`, `sort_order`, `created_by`, `updated_by`, `created_at`, `updated_at`) VALUES
(1, 1, 'HOURLY', 1, 1, 'CIV-DRAFT-HR', 'Contract Drafting – Hourly', 'HOURLY', 75.00, 60, '1', '2026-01-06', '2026-01-08', 220, 225, 1.0000, 281.25, 0.00, 0.00, 281.25, NULL, 0, NULL, NULL, '2026-03-27 06:17:50', '2026-03-27 06:17:50'),
(2, 2, 'FIXED_FEE', 5, 2, 'FAM-DIV-FIXED', 'Divorce Proceedings – Full Service', 'FIXED_FEE', 1200.00, 60, '2', NULL, NULL, 0, 0, 1.0000, 1200.00, 0.00, 0.00, 1200.00, NULL, 0, NULL, NULL, '2026-03-27 06:18:52', '2026-03-27 06:18:52');

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

--
-- Table structure for table `client_invoice_taxes`
--

DROP TABLE IF EXISTS `client_invoice_taxes`;
CREATE TABLE IF NOT EXISTS `client_invoice_taxes` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `invoice_id` bigint UNSIGNED NOT NULL,
  `tax_id` bigint UNSIGNED NOT NULL COMMENT 'FK → taxes.tax_id',
  `tax_name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Snapshot of taxes.tax_name at invoice time',
  `tax_rate` decimal(5,2) NOT NULL,
  `taxable_base` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT 'The amount this tax is applied to',
  `tax_amount` decimal(12,2) NOT NULL DEFAULT '0.00',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_itax_invoice` (`invoice_id`),
  KEY `idx_itax_tax` (`tax_id`)
) ;

--
-- Dumping data for table `client_invoice_taxes`
--

INSERT INTO `client_invoice_taxes` (`id`, `invoice_id`, `tax_id`, `tax_name`, `tax_rate`, `taxable_base`, `tax_amount`, `created_at`, `updated_at`) VALUES
(1, 1, 1, 'VAT', 15.00, 281.25, 42.19, '2026-03-27 06:18:28', '2026-03-27 06:18:28'),
(2, 2, 1, 'VAT', 15.00, 1200.00, 180.00, '2026-03-27 06:19:05', '2026-03-27 06:19:05');

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

--
-- Table structure for table `client_journals`
--

DROP TABLE IF EXISTS `client_journals`;
CREATE TABLE IF NOT EXISTS `client_journals` (
  `id` int NOT NULL AUTO_INCREMENT,
  `date` date NOT NULL,
  `client_code` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `client_name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `narration` text COLLATE utf8mb4_unicode_ci,
  `dr` decimal(15,2) DEFAULT '0.00',
  `cr` decimal(15,2) DEFAULT '0.00',
  `status` enum('pending','approved','rejected','reversed') COLLATE utf8mb4_unicode_ci DEFAULT 'pending',
  `client_id` int DEFAULT NULL,
  `transaction_code` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `transaction_code` (`transaction_code`),
  KEY `idx_date` (`date`),
  KEY `idx_client_code` (`client_code`)
) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `client_journals`
--

INSERT INTO `client_journals` (`id`, `date`, `client_code`, `client_name`, `narration`, `dr`, `cr`, `status`, `client_id`, `transaction_code`, `created_at`, `updated_at`) VALUES
(1, '2026-01-05', 'CL-0001', 'James Whitaker', 'Retainer deposit received into trust - corporate advisory', 2500.00, 0.00, 'approved', 1, 'CJ-2026-0001', '2026-04-01 10:53:15', '2026-04-01 10:53:15'),
(2, '2026-01-08', 'CL-0002', 'Emily Carter', 'Filing fees paid from trust - High Court application', 0.00, 350.00, 'approved', 2, 'CJ-2026-0002', '2026-04-01 10:53:15', '2026-04-01 10:53:15'),
(3, '2026-01-12', 'CL-0003', 'Michael Dube', 'Trust funds received - litigation retainer for Dube Logistics', 1800.00, 0.00, 'approved', 3, 'CJ-2026-0003', '2026-04-01 10:53:15', '2026-04-01 10:53:15'),
(4, '2026-01-15', 'CL001', 'Tendai Moyo', 'Sheriff fees disbursed from trust - process serving', 0.00, 180.00, 'approved', 8, 'CJ-2026-0004', '2026-04-01 10:53:15', '2026-04-01 10:53:15'),
(5, '2026-01-18', 'CL002', 'Rudo Chikore', 'Advocate fees paid from trust - labour court brief', 0.00, 950.00, 'approved', 9, 'CJ-2026-0005', '2026-04-01 10:53:15', '2026-04-01 10:53:15'),
(6, '2026-01-22', 'CL003', 'Farai Dube', 'Retainer received - regulatory compliance case ZimPower', 3200.00, 0.00, 'approved', 10, 'CJ-2026-0006', '2026-04-01 10:53:15', '2026-04-01 10:53:15'),
(7, '2026-01-25', 'CL004', 'Chipo Sibanda', 'Courier fees disbursed from trust - document delivery Delta Beverages', 0.00, 75.00, 'approved', 11, 'CJ-2026-0007', '2026-04-01 10:53:15', '2026-04-01 10:53:15'),
(8, '2026-01-28', 'CL005', 'Blessing Ndlovu', 'Trust interest earned on client funds - hospitality matter', 62.50, 0.00, 'approved', 12, 'CJ-2026-0008', '2026-04-01 10:53:15', '2026-04-01 10:53:15'),
(9, '2026-02-03', 'CL006', 'Memory Zhou', 'High Court filing fee paid from trust - banking dispute', 0.00, 420.00, 'approved', 13, 'CJ-2026-0009', '2026-04-01 10:53:15', '2026-04-01 10:53:15'),
(10, '2026-02-06', 'CL007', 'Simba Katsande', 'Retainer deposit - tender review and procurement advisory', 1500.00, 0.00, 'approved', 14, 'CJ-2026-0010', '2026-04-01 10:53:15', '2026-04-01 10:53:15'),
(11, '2026-02-10', 'CL008', 'Nyasha Mukandi', 'Advocate brief fees paid from trust - student contract matter', 0.00, 600.00, 'approved', 15, 'CJ-2026-0011', '2026-04-01 10:53:15', '2026-04-01 10:53:15'),
(12, '2026-02-13', 'CL009', 'Tawanda Mapfumo', 'Retainer received - mining compliance RioZim', 4500.00, 0.00, 'approved', 16, 'CJ-2026-0012', '2026-04-01 10:53:15', '2026-04-01 10:53:15'),
(13, '2026-02-17', 'CL010', 'Rutendo Goronga', 'Trust admin fees charged - civil litigation file management', 0.00, 150.00, 'approved', 17, 'CJ-2026-0013', '2026-04-01 10:53:15', '2026-04-01 10:53:15'),
(14, '2026-02-20', 'CL011', 'Tatenda Chirwa', 'Retainer deposit - loan agreement advisory ZB Bank matter', 2000.00, 0.00, 'approved', 19, 'CJ-2026-0014', '2026-04-01 10:53:15', '2026-04-01 10:53:15'),
(15, '2026-02-24', 'CL012', 'Lindiwe Ncube', 'Filing fees paid from trust - lease agreement High Court', 0.00, 310.00, 'approved', 20, 'CJ-2026-0015', '2026-04-01 10:53:15', '2026-04-01 10:53:15'),
(16, '2026-03-01', 'CL013', 'Kudakwashe Banda', 'Trust funds received - employment contract dispute ZESA', 1200.00, 0.00, 'approved', 21, 'CJ-2026-0016', '2026-04-01 10:53:15', '2026-04-01 10:53:15'),
(17, '2026-03-04', 'CL014', 'Tsitsi Muchengeti', 'Sheriff fees paid from trust - workplace grievance service', 0.00, 200.00, 'approved', 22, 'CJ-2026-0017', '2026-04-01 10:53:15', '2026-04-01 10:53:15'),
(18, '2026-03-07', 'CL015', 'Elvis Madondo', 'Retainer received - industrial safety compliance ZISCO Steel', 2800.00, 0.00, 'approved', 23, 'CJ-2026-0018', '2026-04-01 10:53:15', '2026-04-01 10:53:15'),
(19, '2026-03-10', 'CL016', 'Rumbidzai Chinoda', 'Courier fees disbursed from trust - document exchange Steward Bank', 0.00, 90.00, 'approved', 24, 'CJ-2026-0019', '2026-04-01 10:53:15', '2026-04-01 10:53:15'),
(20, '2026-03-13', 'CL017', 'Brian Zhou', 'Trust interest credited - export compliance matter', 48.75, 0.00, 'approved', 25, 'CJ-2026-0020', '2026-04-01 10:53:15', '2026-04-01 10:53:15'),
(21, '2026-03-16', 'CL018', 'Faith Makoni', 'Filing fees paid from trust - Teacher Service Commission matter', 0.00, 275.00, 'approved', 26, 'CJ-2026-0021', '2026-04-01 10:53:15', '2026-04-01 10:53:15'),
(22, '2026-03-19', 'CL019', 'Percy Ndlovu', 'Retainer deposit - tourism licensing dispute', 1750.00, 0.00, 'approved', 27, 'CJ-2026-0022', '2026-04-01 10:53:15', '2026-04-01 10:53:15'),
(23, '2026-03-22', 'CL020', 'Shamiso Gumbo', 'Advocate fees paid from trust - business registration matter Startup Hub', 0.00, 780.00, 'approved', 28, 'CJ-2026-0023', '2026-04-01 10:53:15', '2026-04-01 10:53:15'),
(24, '2026-03-25', 'CL-0005', 'Daniel Mukasa', 'Trust funds received - regulatory safety compliance Mukasa Engineering', 3500.00, 0.00, 'approved', 5, 'CJ-2026-0024', '2026-04-01 10:53:15', '2026-04-01 10:53:15'),
(25, '2026-03-28', 'CL1870787', 'Herr Gwena', 'Trust admin fees charged - HNWI cross-border advisory Gwena AG', 0.00, 400.00, 'approved', 18, 'CJ-2026-0025', '2026-04-01 10:53:15', '2026-04-01 10:53:15');

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

--
-- Table structure for table `client_quotations`
--

DROP TABLE IF EXISTS `client_quotations`;
CREATE TABLE IF NOT EXISTS `client_quotations` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `quotation_number` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `quotation_date` date NOT NULL,
  `client_id` bigint UNSIGNED DEFAULT NULL COMMENT 'FK → clients.id',
  `client_name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Denormalised for quick display / printing',
  `matter_id` bigint UNSIGNED DEFAULT NULL,
  `case_id` bigint UNSIGNED DEFAULT NULL,
  `responsible_lawyer` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'FK → lawyers.lawyer_id',
  `validity_days` int NOT NULL DEFAULT '30',
  `expiry_date` date GENERATED ALWAYS AS ((`quotation_date` + interval `validity_days` day)) STORED,
  `terms` text COLLATE utf8mb4_unicode_ci,
  `notes` text COLLATE utf8mb4_unicode_ci,
  `scope_of_work` text COLLATE utf8mb4_unicode_ci COMMENT 'Plain-language description of services quoted',
  `currency_id` bigint UNSIGNED DEFAULT NULL,
  `subtotal` decimal(12,2) NOT NULL DEFAULT '0.00',
  `tax_total` decimal(12,2) NOT NULL DEFAULT '0.00',
  `discount_total` decimal(12,2) NOT NULL DEFAULT '0.00',
  `total_amount` decimal(12,2) NOT NULL DEFAULT '0.00',
  `status` enum('draft','sent','accepted','rejected','expired','converted') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'draft',
  `sent_at` timestamp NULL DEFAULT NULL,
  `responded_at` timestamp NULL DEFAULT NULL,
  `converted_invoice_id` bigint UNSIGNED DEFAULT NULL COMMENT 'Set when this quotation is converted to an invoice',
  `created_by` bigint UNSIGNED DEFAULT NULL,
  `updated_by` bigint UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uq_quotation_number` (`quotation_number`),
  KEY `idx_quot_client` (`client_id`),
  KEY `idx_quot_matter` (`matter_id`),
  KEY `idx_quot_lawyer` (`responsible_lawyer`),
  KEY `idx_quot_status` (`status`),
  KEY `idx_quot_date` (`quotation_date`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Client quotation (estimate). Each line is a client_quotation_line. On acceptance, a fee_arrangement is created and status → accepted.';

--
-- Dumping data for table `client_quotations`
--

INSERT INTO `client_quotations` (`id`, `quotation_number`, `quotation_date`, `client_id`, `client_name`, `matter_id`, `case_id`, `responsible_lawyer`, `validity_days`, `terms`, `notes`, `scope_of_work`, `currency_id`, `subtotal`, `tax_total`, `discount_total`, `total_amount`, `status`, `sent_at`, `responded_at`, `converted_invoice_id`, `created_by`, `updated_by`, `created_at`, `updated_at`) VALUES
(1, 'QT-001', '2026-01-09', 2, 'John Dube', 102, NULL, '2', 30, NULL, NULL, NULL, 1, 1200.00, 180.00, 0.00, 1380.00, 'converted', NULL, NULL, NULL, NULL, NULL, '2026-03-27 06:17:02', '2026-03-27 06:17:02');

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

--
-- Table structure for table `client_quotation_lines`
--

DROP TABLE IF EXISTS `client_quotation_lines`;
CREATE TABLE IF NOT EXISTS `client_quotation_lines` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `quotation_id` bigint UNSIGNED NOT NULL COMMENT 'FK → client_quotations.id',
  `tariff_id` int DEFAULT NULL COMMENT 'FK → tariffs (NULL = free-text line)',
  `charge_type` enum('FIXED_FEE','HOURLY','PER_APPEARANCE','DISBURSEMENT','OTHER') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'FIXED_FEE',
  `service_code` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `description` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `quantity` decimal(10,4) NOT NULL DEFAULT '1.0000' COMMENT 'Units or estimated hours',
  `unit_price` decimal(12,2) NOT NULL DEFAULT '0.00',
  `discount_pct` decimal(5,2) NOT NULL DEFAULT '0.00',
  `discount_amount` decimal(12,2) NOT NULL DEFAULT '0.00',
  `tax_rate` decimal(5,2) NOT NULL DEFAULT '0.00',
  `tax_amount` decimal(12,2) NOT NULL DEFAULT '0.00',
  `line_total` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '(unit_price × quantity − discount) + tax',
  `sort_order` int NOT NULL DEFAULT '0',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_qline_quotation` (`quotation_id`),
  KEY `idx_qline_tariff` (`tariff_id`)
) ;

--
-- Dumping data for table `client_quotation_lines`
--

INSERT INTO `client_quotation_lines` (`id`, `quotation_id`, `tariff_id`, `charge_type`, `service_code`, `description`, `quantity`, `unit_price`, `discount_pct`, `discount_amount`, `tax_rate`, `tax_amount`, `line_total`, `sort_order`, `created_at`, `updated_at`) VALUES
(1, 1, 5, 'FIXED_FEE', NULL, 'Full divorce proceedings', 1.0000, 1200.00, 0.00, 0.00, 15.00, 180.00, 1380.00, 0, '2026-03-27 06:17:13', '2026-03-27 06:17:13');

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

--
-- Table structure for table `client_receipts`
--

DROP TABLE IF EXISTS `client_receipts`;
CREATE TABLE IF NOT EXISTS `client_receipts` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `receipt_number` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `receipt_date` date NOT NULL,
  `client_id` bigint UNSIGNED NOT NULL COMMENT 'FK → clients.id',
  `matter_id` bigint UNSIGNED DEFAULT NULL,
  `responsible_lawyer` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `payment_method` enum('cash','bank_transfer','cheque','mobile_money','card','trust_transfer','other') COLLATE utf8mb4_unicode_ci NOT NULL,
  `payment_reference` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Bank ref, cheque number, mobile money ref etc.',
  `bank_account` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `currency_id` bigint UNSIGNED DEFAULT NULL,
  `total_amount` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT 'Must equal sum of receipt_lines.amount_applied',
  `exchange_rate` decimal(15,6) NOT NULL DEFAULT '1.000000',
  `notes` text COLLATE utf8mb4_unicode_ci,
  `status` enum('draft','processed','reversed') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'draft',
  `reversed_at` timestamp NULL DEFAULT NULL,
  `reversal_reason` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_by` bigint UNSIGNED DEFAULT NULL,
  `updated_by` bigint UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uq_receipt_number` (`receipt_number`),
  KEY `idx_rec_client` (`client_id`),
  KEY `idx_rec_matter` (`matter_id`),
  KEY `idx_rec_status` (`status`),
  KEY `idx_rec_date` (`receipt_date`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Payment receipt. One receipt can allocate payment across multiple invoices via client_receipt_lines.';

--
-- Dumping data for table `client_receipts`
--

INSERT INTO `client_receipts` (`id`, `receipt_number`, `receipt_date`, `client_id`, `matter_id`, `responsible_lawyer`, `payment_method`, `payment_reference`, `bank_account`, `currency_id`, `total_amount`, `exchange_rate`, `notes`, `status`, `reversed_at`, `reversal_reason`, `created_by`, `updated_by`, `created_at`, `updated_at`) VALUES
(1, 'RCPT-001', '2026-01-20', 1, 101, NULL, 'bank_transfer', NULL, NULL, 1, 150.00, 1.000000, NULL, 'processed', NULL, NULL, NULL, NULL, '2026-03-27 06:19:14', '2026-03-27 06:19:14');

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

--
-- Table structure for table `client_receipt_lines`
--

DROP TABLE IF EXISTS `client_receipt_lines`;
CREATE TABLE IF NOT EXISTS `client_receipt_lines` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `receipt_id` bigint UNSIGNED NOT NULL COMMENT 'FK → client_receipts.id',
  `invoice_id` bigint UNSIGNED NOT NULL COMMENT 'FK → client_invoices.id',
  `account_id` bigint UNSIGNED DEFAULT NULL COMMENT 'FK → general_ledger_accounts.id',
  `description` text COLLATE utf8mb4_unicode_ci,
  `amount_applied` decimal(12,2) NOT NULL COMMENT 'How much of this receipt is applied to this invoice',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_rline_receipt` (`receipt_id`),
  KEY `idx_rline_invoice` (`invoice_id`),
  KEY `idx_rline_account` (`account_id`)
) ;

--
-- Dumping data for table `client_receipt_lines`
--

INSERT INTO `client_receipt_lines` (`id`, `receipt_id`, `invoice_id`, `account_id`, `description`, `amount_applied`, `created_at`, `updated_at`) VALUES
(1, 1, 1, NULL, NULL, 150.00, '2026-03-27 06:19:24', '2026-03-27 06:19:24');

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

--
-- Table structure for table `client_trust_accounts`
--

DROP TABLE IF EXISTS `client_trust_accounts`;
CREATE TABLE IF NOT EXISTS `client_trust_accounts` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `client_id` bigint UNSIGNED NOT NULL,
  `account_number` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `currency` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'USD',
  `status` enum('active','closed','suspended') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'active',
  `opened_at` timestamp NOT NULL,
  `closed_at` timestamp NULL DEFAULT NULL,
  `created_by` bigint UNSIGNED DEFAULT NULL,
  `updated_by` bigint UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `client_trust_accounts_account_number_unique` (`account_number`),
  KEY `client_trust_accounts_created_by_foreign` (`created_by`),
  KEY `client_trust_accounts_updated_by_foreign` (`updated_by`),
  KEY `client_trust_accounts_client_id_index` (`client_id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `client_trust_accounts`
--

INSERT INTO `client_trust_accounts` (`id`, `client_id`, `account_number`, `currency`, `status`, `opened_at`, `closed_at`, `created_by`, `updated_by`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 18, 'HERRGWENA-001', 'CUR001', 'active', '2026-03-23 22:00:00', NULL, 1, 1, '2026-03-24 18:20:38', '2026-03-24 18:20:38', NULL);

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

--
-- Table structure for table `conflict_checks`
--

DROP TABLE IF EXISTS `conflict_checks`;
CREATE TABLE IF NOT EXISTS `conflict_checks` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `requested_by` bigint UNSIGNED DEFAULT NULL,
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `notes` text COLLATE utf8mb4_unicode_ci,
  `client_names` text COLLATE utf8mb4_unicode_ci,
  `opposing_parties` text COLLATE utf8mb4_unicode_ci,
  `company_names` text COLLATE utf8mb4_unicode_ci,
  `created_by` bigint UNSIGNED DEFAULT NULL,
  `updated_by` bigint UNSIGNED DEFAULT NULL,
  `resolved_by` bigint UNSIGNED DEFAULT NULL,
  `resolved_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `conflict_checks_created_by_foreign` (`created_by`),
  KEY `conflict_checks_updated_by_foreign` (`updated_by`),
  KEY `conflict_checks_requested_by_index` (`requested_by`),
  KEY `conflict_checks_resolved_by_index` (`resolved_by`)
) ENGINE=InnoDB AUTO_INCREMENT=39 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `conflict_checks`
--

INSERT INTO `conflict_checks` (`id`, `requested_by`, `status`, `notes`, `client_names`, `opposing_parties`, `company_names`, `created_by`, `updated_by`, `resolved_by`, `resolved_at`, `created_at`, `updated_at`) VALUES
(1, 8, 'Pending Review', 'Seeded conflict check', NULL, NULL, NULL, 8, 8, NULL, NULL, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(2, 8, 'Conflict Found', 'Seeded conflict check', NULL, NULL, NULL, 8, 8, NULL, NULL, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(3, 8, 'Cleared', 'Seeded conflict check', NULL, NULL, NULL, 8, 8, NULL, NULL, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(4, 8, 'Cleared', 'Seeded conflict check', NULL, NULL, NULL, 8, 8, NULL, NULL, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(5, 8, 'Cleared', 'Seeded conflict check', NULL, NULL, NULL, 8, 8, NULL, NULL, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(6, 8, 'Conflict Found', 'Seeded conflict check', NULL, NULL, NULL, 8, 8, NULL, NULL, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(7, 8, 'Conflict Found', 'Seeded conflict check', NULL, NULL, NULL, 8, 8, NULL, NULL, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(8, 8, 'Conflict Found', 'Seeded conflict check', NULL, NULL, NULL, 8, 8, NULL, NULL, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(9, 8, 'Pending Review', 'Seeded conflict check', NULL, NULL, NULL, 8, 8, NULL, NULL, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(10, 8, 'Pending Review', 'Seeded conflict check', NULL, NULL, NULL, 8, 8, NULL, NULL, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(11, 8, 'Pending Review', 'Seeded conflict check', NULL, NULL, NULL, 8, 8, NULL, NULL, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(12, 8, 'Pending Review', 'Seeded conflict check', NULL, NULL, NULL, 8, 8, NULL, NULL, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(13, 8, 'Conflict Found', 'Seeded conflict check', NULL, NULL, NULL, 8, 8, NULL, NULL, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(14, 8, 'Pending Review', 'Seeded conflict check', NULL, NULL, NULL, 8, 8, NULL, NULL, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(15, 8, 'Cleared', 'Seeded conflict check', NULL, NULL, NULL, 8, 8, NULL, NULL, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(16, 8, 'Pending Review', 'Seeded conflict check', NULL, NULL, NULL, 8, 8, NULL, NULL, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(17, 8, 'Cleared', 'Seeded conflict check', NULL, NULL, NULL, 8, 8, NULL, NULL, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(18, 8, 'Cleared', 'Seeded conflict check', NULL, NULL, NULL, 8, 8, NULL, NULL, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(19, 8, 'Pending Review', 'Seeded conflict check', NULL, NULL, NULL, 8, 8, NULL, NULL, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(20, 8, 'Pending Review', 'Seeded conflict check', NULL, NULL, NULL, 8, 8, NULL, NULL, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(21, 8, 'Conflict Found', 'Seeded conflict check', NULL, NULL, NULL, 8, 8, NULL, NULL, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(22, 8, 'Conflict Found', 'Seeded conflict check', NULL, NULL, NULL, 8, 8, NULL, NULL, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(23, 8, 'Conflict Found', 'Seeded conflict check', NULL, NULL, NULL, 8, 8, NULL, NULL, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(24, 8, 'Cleared', 'Seeded conflict check', NULL, NULL, NULL, 8, 8, NULL, NULL, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(25, 8, 'Cleared', 'Seeded conflict check', NULL, NULL, NULL, 8, 8, NULL, NULL, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(26, 1, 'Conflict Found', NULL, NULL, NULL, NULL, 1, 1, NULL, NULL, '2026-03-22 10:28:44', '2026-03-22 10:28:44'),
(27, 1, 'Conflict Found', NULL, NULL, NULL, NULL, 1, 1, NULL, NULL, '2026-03-22 10:29:28', '2026-03-22 10:29:28'),
(28, 1, 'Conflict Found', NULL, NULL, NULL, NULL, 1, 1, NULL, NULL, '2026-03-22 11:27:58', '2026-03-22 11:27:58'),
(29, 1, 'Conflict Found', NULL, NULL, NULL, NULL, 1, 1, NULL, NULL, '2026-03-22 11:29:35', '2026-03-22 11:29:35'),
(30, 1, 'Conflict Found', NULL, NULL, NULL, NULL, 1, 1, NULL, NULL, '2026-03-22 11:44:18', '2026-03-22 11:44:18'),
(31, 1, 'Conflict Found', NULL, NULL, NULL, NULL, 1, 1, NULL, NULL, '2026-03-22 11:46:22', '2026-03-22 11:46:22'),
(32, 1, 'Conflict Found', NULL, NULL, NULL, NULL, 1, 1, NULL, NULL, '2026-03-22 11:51:06', '2026-03-22 11:51:06'),
(33, 1, 'Pending Review', NULL, 'herr gwena', 'james whitaker', NULL, 1, 1, NULL, NULL, '2026-03-23 08:59:28', '2026-03-23 08:59:28'),
(34, 1, 'Pending Review', NULL, 'herr gwena', 'mrs gwena', NULL, 1, 1, NULL, NULL, '2026-03-23 08:59:47', '2026-03-23 08:59:47'),
(35, 1, 'Pending Review', NULL, 'herr gwena', 'lord radio', NULL, 1, 1, NULL, NULL, '2026-03-23 09:00:01', '2026-03-23 09:00:01'),
(36, 1, 'Cleared', NULL, 'herr gwena', 'lord bedn', NULL, 1, 1, NULL, NULL, '2026-03-23 09:02:27', '2026-03-23 09:02:27'),
(37, 1, 'Cleared', NULL, 'herr gwena', 'none', NULL, 1, 1, NULL, NULL, '2026-03-23 10:48:08', '2026-03-23 10:48:08'),
(38, 1, 'Cleared', NULL, 'herr gwena', 'estate of the family', NULL, 1, 1, NULL, NULL, '2026-03-23 11:05:09', '2026-03-23 11:05:09');

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

--
-- Table structure for table `conflict_results`
--

DROP TABLE IF EXISTS `conflict_results`;
CREATE TABLE IF NOT EXISTS `conflict_results` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `conflict_check_id` bigint UNSIGNED NOT NULL,
  `matched_entity_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `matched_entity_id` bigint UNSIGNED DEFAULT NULL,
  `matched_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `match_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `conflict_results_conflict_check_id_foreign` (`conflict_check_id`)
) ENGINE=InnoDB AUTO_INCREMENT=44 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `conflict_results`
--

INSERT INTO `conflict_results` (`id`, `conflict_check_id`, `matched_entity_type`, `matched_entity_id`, `matched_name`, `match_type`, `created_at`, `updated_at`) VALUES
(1, 25, 'Matter', NULL, 'Seeded Match ZwHC', 'Potential', '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(2, 24, 'Matter', NULL, 'Seeded Match XPLT', 'Potential', '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(3, 23, 'Matter', NULL, 'Seeded Match az2l', 'Potential', '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(4, 22, 'Matter', NULL, 'Seeded Match wLMj', 'Potential', '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(5, 21, 'Matter', NULL, 'Seeded Match ncwb', 'Potential', '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(6, 20, 'Matter', NULL, 'Seeded Match gMRb', 'Potential', '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(7, 19, 'Matter', NULL, 'Seeded Match lxLo', 'Potential', '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(8, 18, 'Matter', NULL, 'Seeded Match hIay', 'Potential', '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(9, 17, 'Matter', NULL, 'Seeded Match GvAC', 'Potential', '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(10, 16, 'Matter', NULL, 'Seeded Match xK4n', 'Potential', '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(11, 15, 'Matter', NULL, 'Seeded Match Ded6', 'Potential', '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(12, 14, 'Matter', NULL, 'Seeded Match EjfZ', 'Potential', '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(13, 13, 'Matter', NULL, 'Seeded Match Xp7u', 'Potential', '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(14, 12, 'Matter', NULL, 'Seeded Match Ifh8', 'Potential', '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(15, 11, 'Matter', NULL, 'Seeded Match AOir', 'Potential', '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(16, 10, 'Matter', NULL, 'Seeded Match rfZd', 'Potential', '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(17, 9, 'Matter', NULL, 'Seeded Match usuK', 'Potential', '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(18, 8, 'Matter', NULL, 'Seeded Match Uy76', 'Potential', '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(19, 7, 'Matter', NULL, 'Seeded Match 1rbi', 'Potential', '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(20, 6, 'Matter', NULL, 'Seeded Match hWgf', 'Potential', '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(21, 5, 'Matter', NULL, 'Seeded Match wrgP', 'Potential', '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(22, 4, 'Matter', NULL, 'Seeded Match RkWH', 'Potential', '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(23, 3, 'Matter', NULL, 'Seeded Match nP6d', 'Potential', '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(24, 2, 'Matter', NULL, 'Seeded Match jcMi', 'Potential', '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(25, 1, 'Matter', NULL, 'Seeded Match 1SHS', 'Potential', '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(26, 26, 'client', 1, 'James Whitaker', 'name', '2026-03-22 10:28:44', '2026-03-22 10:28:44'),
(27, 26, 'client', 2, 'Emily Carter', 'name', '2026-03-22 10:28:44', '2026-03-22 10:28:44'),
(28, 27, 'client', 1, 'James Whitaker', 'name', '2026-03-22 10:29:28', '2026-03-22 10:29:28'),
(29, 27, 'client', 2, 'Emily Carter', 'name', '2026-03-22 10:29:28', '2026-03-22 10:29:28'),
(30, 28, 'client', 1, 'James Whitaker', 'name', '2026-03-22 11:27:58', '2026-03-22 11:27:58'),
(31, 28, 'client', 8, 'Tendai Moyo', 'name', '2026-03-22 11:27:58', '2026-03-22 11:27:58'),
(32, 29, 'client', 1, 'James Whitaker', 'name', '2026-03-22 11:29:35', '2026-03-22 11:29:35'),
(33, 29, 'client', 15, 'Nyasha Mukandi', 'name', '2026-03-22 11:29:35', '2026-03-22 11:29:35'),
(34, 30, 'client', 1, 'James Whitaker', 'name', '2026-03-22 11:44:18', '2026-03-22 11:44:18'),
(35, 30, 'client', 2, 'Emily Carter', 'name', '2026-03-22 11:44:18', '2026-03-22 11:44:18'),
(36, 31, 'client', 13, 'Memory Zhou', 'name', '2026-03-22 11:46:22', '2026-03-22 11:46:22'),
(37, 31, 'client', 16, 'Tawanda Mapfumo', 'name', '2026-03-22 11:46:22', '2026-03-22 11:46:22'),
(38, 32, 'client', 1, 'James Whitaker', 'name', '2026-03-22 11:51:06', '2026-03-22 11:51:06'),
(39, 32, 'client', 8, 'Tendai Moyo', 'name', '2026-03-22 11:51:06', '2026-03-22 11:51:06'),
(40, 33, 'client', 18, 'Herr Gwena', 'name', '2026-03-23 08:59:28', '2026-03-23 08:59:28'),
(41, 33, 'client', 1, 'James Whitaker', 'name', '2026-03-23 08:59:28', '2026-03-23 08:59:28'),
(42, 34, 'client', 18, 'Herr Gwena', 'name', '2026-03-23 08:59:47', '2026-03-23 08:59:47'),
(43, 35, 'client', 18, 'Herr Gwena', 'name', '2026-03-23 09:00:01', '2026-03-23 09:00:01');

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

--
-- Table structure for table `conflict_search_terms`
--

DROP TABLE IF EXISTS `conflict_search_terms`;
CREATE TABLE IF NOT EXISTS `conflict_search_terms` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `conflict_check_id` bigint UNSIGNED NOT NULL,
  `search_term` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `entity_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `conflict_search_terms_conflict_check_id_foreign` (`conflict_check_id`)
) ENGINE=InnoDB AUTO_INCREMENT=52 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `conflict_search_terms`
--

INSERT INTO `conflict_search_terms` (`id`, `conflict_check_id`, `search_term`, `entity_type`, `created_at`, `updated_at`) VALUES
(1, 25, 'Seed Term C8KcB', 'Client', '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(2, 24, 'Seed Term uMDUN', 'Client', '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(3, 23, 'Seed Term 8nMMy', 'Client', '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(4, 22, 'Seed Term qr1K5', 'Client', '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(5, 21, 'Seed Term KlDXw', 'Client', '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(6, 20, 'Seed Term Fmy0n', 'Client', '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(7, 19, 'Seed Term BNzmK', 'Client', '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(8, 18, 'Seed Term MlUIC', 'Client', '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(9, 17, 'Seed Term ACXfT', 'Client', '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(10, 16, 'Seed Term 1h0di', 'Client', '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(11, 15, 'Seed Term GSoF3', 'Client', '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(12, 14, 'Seed Term 99bwA', 'Client', '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(13, 13, 'Seed Term EKNK8', 'Client', '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(14, 12, 'Seed Term crAvv', 'Client', '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(15, 11, 'Seed Term YO23w', 'Client', '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(16, 10, 'Seed Term q4RUq', 'Client', '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(17, 9, 'Seed Term AcO2W', 'Client', '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(18, 8, 'Seed Term B1u7u', 'Client', '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(19, 7, 'Seed Term NZHay', 'Client', '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(20, 6, 'Seed Term VX1dW', 'Client', '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(21, 5, 'Seed Term ADd6v', 'Client', '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(22, 4, 'Seed Term 9Bnvi', 'Client', '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(23, 3, 'Seed Term sa9pq', 'Client', '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(24, 2, 'Seed Term TWIwl', 'Client', '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(25, 1, 'Seed Term Khl65', 'Client', '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(26, 26, 'james whitaker', 'client', '2026-03-22 10:28:44', '2026-03-22 10:28:44'),
(27, 26, 'emily carter', 'opposing_party', '2026-03-22 10:28:44', '2026-03-22 10:28:44'),
(28, 27, 'james whitaker', 'client', '2026-03-22 10:29:28', '2026-03-22 10:29:28'),
(29, 27, 'emily carter', 'opposing_party', '2026-03-22 10:29:28', '2026-03-22 10:29:28'),
(30, 28, 'james whitaker', 'client', '2026-03-22 11:27:58', '2026-03-22 11:27:58'),
(31, 28, 'tendai moyo', 'opposing_party', '2026-03-22 11:27:58', '2026-03-22 11:27:58'),
(32, 29, 'james whitaker', 'client', '2026-03-22 11:29:35', '2026-03-22 11:29:35'),
(33, 29, 'nyasha mukandi', 'opposing_party', '2026-03-22 11:29:35', '2026-03-22 11:29:35'),
(34, 30, 'james whitaker', 'client', '2026-03-22 11:44:18', '2026-03-22 11:44:18'),
(35, 30, 'emily carter', 'opposing_party', '2026-03-22 11:44:18', '2026-03-22 11:44:18'),
(36, 31, 'memory zhou', 'client', '2026-03-22 11:46:22', '2026-03-22 11:46:22'),
(37, 31, 'tawanda mapfumo', 'opposing_party', '2026-03-22 11:46:22', '2026-03-22 11:46:22'),
(38, 32, 'james whitaker', 'client', '2026-03-22 11:51:06', '2026-03-22 11:51:06'),
(39, 32, 'tendai moyo', 'opposing_party', '2026-03-22 11:51:06', '2026-03-22 11:51:06'),
(40, 33, 'herr gwena', 'client', '2026-03-23 08:59:28', '2026-03-23 08:59:28'),
(41, 33, 'james whitaker', 'opposing_party', '2026-03-23 08:59:28', '2026-03-23 08:59:28'),
(42, 34, 'herr gwena', 'client', '2026-03-23 08:59:47', '2026-03-23 08:59:47'),
(43, 34, 'mrs gwena', 'opposing_party', '2026-03-23 08:59:47', '2026-03-23 08:59:47'),
(44, 35, 'herr gwena', 'client', '2026-03-23 09:00:01', '2026-03-23 09:00:01'),
(45, 35, 'lord radio', 'opposing_party', '2026-03-23 09:00:01', '2026-03-23 09:00:01'),
(46, 36, 'herr gwena', 'client', '2026-03-23 09:02:27', '2026-03-23 09:02:27'),
(47, 36, 'lord bedn', 'opposing_party', '2026-03-23 09:02:27', '2026-03-23 09:02:27'),
(48, 37, 'herr gwena', 'client', '2026-03-23 10:48:08', '2026-03-23 10:48:08'),
(49, 37, 'none', 'opposing_party', '2026-03-23 10:48:08', '2026-03-23 10:48:08'),
(50, 38, 'herr gwena', 'client', '2026-03-23 11:05:09', '2026-03-23 11:05:09'),
(51, 38, 'estate of the family', 'opposing_party', '2026-03-23 11:05:09', '2026-03-23 11:05:09');

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

--
-- Table structure for table `court_areas`
--

DROP TABLE IF EXISTS `court_areas`;
CREATE TABLE IF NOT EXISTS `court_areas` (
  `area_code` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
  `area_name` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
  `city` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `country` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT 'Zimbabwe',
  `specific_location` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`area_code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `court_areas`
--

INSERT INTO `court_areas` (`area_code`, `area_name`, `city`, `country`, `specific_location`, `created_at`, `updated_at`) VALUES
('CA-BHC', 'Bulawayo High Court', 'Bulawayo', 'Zimbabwe', 'Corner Fort Street & 10th Avenue', '2026-03-27 06:43:31', '2026-03-27 06:43:31'),
('CA-BYO', 'Bulawayo Magistrates Court', 'Bulawayo', 'Zimbabwe', 'Fife Street', '2026-03-27 06:43:31', '2026-03-27 06:43:31'),
('CA-CHI', 'Chinhoyi Magistrates Court', 'Chinhoyi', 'Zimbabwe', 'Magistrates Court Complex', '2026-03-27 06:43:31', '2026-03-27 06:43:31'),
('CA-GWE', 'Gweru Magistrates Court', 'Gweru', 'Zimbabwe', 'Robert Mugabe Way', '2026-03-27 06:43:31', '2026-03-27 06:43:31'),
('CA-HHC', 'Harare High Court', 'Harare', 'Zimbabwe', 'Samora Machel Avenue', '2026-03-27 06:43:31', '2026-03-27 06:43:31'),
('CA-HRE', 'Harare Magistrates Court', 'Harare', 'Zimbabwe', 'Corner Samora Machel Ave & Rotten Row', '2026-03-27 06:43:31', '2026-03-27 06:43:31'),
('CA-MAR', 'Marondera Magistrates Court', 'Marondera', 'Zimbabwe', 'Fifth Street', '2026-03-27 06:43:31', '2026-03-27 06:43:31'),
('CA-MAS', 'Masvingo Magistrates Court', 'Masvingo', 'Zimbabwe', 'Hughes Street', '2026-03-27 06:43:31', '2026-03-27 06:43:31'),
('CA-MUT', 'Mutare Magistrates Court', 'Mutare', 'Zimbabwe', 'Aerodrome Road', '2026-03-27 06:43:31', '2026-03-27 06:43:31'),
('CA-VIC', 'Victoria Falls Magistrates Court', 'Victoria Falls', 'Zimbabwe', 'Parkway Drive', '2026-03-27 06:43:31', '2026-03-27 06:43:31');

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

--
-- Table structure for table `court_types`
--

DROP TABLE IF EXISTS `court_types`;
CREATE TABLE IF NOT EXISTS `court_types` (
  `court_type_id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `type_name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`court_type_id`),
  UNIQUE KEY `type_name` (`type_name`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `court_types`
--

INSERT INTO `court_types` (`court_type_id`, `type_name`, `description`, `created_at`, `updated_at`) VALUES
(1, 'Magistrates Court', 'Handles minor criminal and civil matters', '2026-03-27 06:43:31', '2026-03-27 06:43:31'),
(2, 'High Court', 'Handles serious criminal cases and major civil disputes', '2026-03-27 06:43:31', '2026-03-27 06:43:31'),
(3, 'Supreme Court', 'Final court of appeal in Zimbabwe', '2026-03-27 06:43:31', '2026-03-27 06:43:31'),
(4, 'Constitutional Court', 'Interprets and enforces the Constitution', '2026-03-27 06:43:31', '2026-03-27 06:43:31'),
(5, 'Labour Court', 'Handles labour and employment disputes', '2026-03-27 06:43:31', '2026-03-27 06:43:31'),
(6, 'Administrative Court', 'Deals with administrative and electoral matters', '2026-03-27 06:43:31', '2026-03-27 06:43:31'),
(7, 'Family Court', 'Handles family law matters including divorce and custody', '2026-03-27 06:43:31', '2026-03-27 06:43:31'),
(8, 'Juvenile Court', 'Handles cases involving minors', '2026-03-27 06:43:31', '2026-03-27 06:43:31'),
(9, 'Commercial Court', 'Handles commercial and business disputes', '2026-03-27 06:43:31', '2026-03-27 06:43:31'),
(10, 'Small Claims Court', 'Handles low-value civil claims', '2026-03-27 06:43:31', '2026-03-27 06:43:31');

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

--
-- Table structure for table `currencies`
--

DROP TABLE IF EXISTS `currencies`;
CREATE TABLE IF NOT EXISTS `currencies` (
  `currency_id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `currency_code` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL,
  `currency_name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `symbol` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `country` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `is_active` tinyint(1) DEFAULT '1',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`currency_id`),
  UNIQUE KEY `currency_code` (`currency_code`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `currencies`
--

INSERT INTO `currencies` (`currency_id`, `currency_code`, `currency_name`, `symbol`, `country`, `is_active`, `created_at`, `updated_at`) VALUES
(1, 'CUR001', 'United States Dollar', 'USD', 'United States of America', 1, '2026-01-05 07:03:06', '2026-01-05 07:03:06'),
(2, 'CUR002', 'Zimbabwe Gold', 'ZWG', 'Zimbabwe', 1, '2026-01-05 07:03:39', '2026-01-05 07:03:39'),
(3, 'CUR003', 'South African Rand', 'ZAR', 'South Africa', 1, '2026-01-05 07:04:19', '2026-01-05 07:04:19');

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

--
-- Table structure for table `currency_rates`
--

DROP TABLE IF EXISTS `currency_rates`;
CREATE TABLE IF NOT EXISTS `currency_rates` (
  `rate_id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `base_currency_id` bigint UNSIGNED NOT NULL,
  `target_currency_id` bigint UNSIGNED NOT NULL,
  `rate_date` date DEFAULT NULL,
  `buy_rate` decimal(15,6) NOT NULL,
  `sell_rate` decimal(15,6) NOT NULL,
  `source` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_by` bigint UNSIGNED DEFAULT NULL,
  `updated_by` bigint UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`rate_id`),
  UNIQUE KEY `unique_currency_rate` (`base_currency_id`,`target_currency_id`,`rate_date`),
  UNIQUE KEY `unique_rate` (`base_currency_id`,`target_currency_id`,`rate_date`),
  KEY `target_currency_id` (`target_currency_id`),
  KEY `fk_currency_rates_created_by` (`created_by`),
  KEY `fk_currency_rates_updated_by` (`updated_by`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `currency_rates`
--

INSERT INTO `currency_rates` (`rate_id`, `base_currency_id`, `target_currency_id`, `rate_date`, `buy_rate`, `sell_rate`, `source`, `created_by`, `updated_by`, `created_at`, `updated_at`) VALUES
(1, 2, 1, '2026-01-05', 29.500000, 30.000000, 'RBZ', 1, 1, '2026-01-05 07:04:50', '2026-03-10 21:23:01');

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

--
-- Table structure for table `departments`
--

DROP TABLE IF EXISTS `departments`;
CREATE TABLE IF NOT EXISTS `departments` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `code` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `created_by` bigint UNSIGNED DEFAULT NULL,
  `updated_by` bigint UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `departments_code_unique` (`code`),
  KEY `departments_created_by_foreign` (`created_by`),
  KEY `departments_updated_by_foreign` (`updated_by`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `departments`
--

INSERT INTO `departments` (`id`, `name`, `code`, `description`, `created_by`, `updated_by`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 'Corporate Law', 'CORP', 'Handles corporate governance, mergers, and acquisitions', 1, 1, '2026-03-24 12:01:18', '2026-03-24 12:01:18', NULL),
(2, 'Litigation', 'LIT', 'Manages disputes, court cases, and legal proceedings', 1, 1, '2026-03-24 12:01:18', '2026-03-24 12:01:18', NULL),
(3, 'Intellectual Property', 'IP', 'Protects patents, trademarks, and copyrights', 1, 1, '2026-03-24 12:01:18', '2026-03-24 12:01:18', NULL),
(4, 'Real Estate Law', 'REAL_ESTATE', 'Deals with property transactions and disputes', 1, 1, '2026-03-24 12:01:18', '2026-03-24 12:01:18', NULL),
(5, 'Family Law', 'FAMILY', 'Handles divorce, custody, and family-related cases', 1, 1, '2026-03-24 12:01:18', '2026-03-24 12:01:18', NULL),
(6, 'Criminal Law', 'CRIMINAL', 'Represents clients in criminal cases', 1, 1, '2026-03-24 12:01:18', '2026-03-24 12:01:18', NULL),
(7, 'Tax Law', 'TAX', 'Advises on tax compliance and disputes', 1, 1, '2026-03-24 12:01:18', '2026-03-24 12:01:18', NULL),
(8, 'Employment Law', 'EMPLOYMENT', 'Handles labor laws, contracts, and disputes', 1, 1, '2026-03-24 12:01:18', '2026-03-24 12:01:18', NULL),
(9, 'Immigration Law', 'IMMIGRATION', 'Deals with visas, residency, and citizenship matters', 1, 1, '2026-03-24 12:01:18', '2026-03-24 12:01:18', NULL),
(10, 'Compliance & Risk', 'COMPLIANCE', 'Ensures regulatory compliance and risk management', 1, 1, '2026-03-24 12:01:18', '2026-03-24 12:01:18', NULL),
(11, 'Legal Research', 'RESEARCH', 'Supports case preparation and legal documentation', 1, 1, '2026-03-24 12:01:18', '2026-03-24 12:01:18', NULL),
(12, 'Administration', 'ADMIN', 'Manages internal operations and office administration', 1, 1, '2026-03-24 12:01:18', '2026-03-24 12:01:18', NULL),
(13, 'Finance & Accounts', 'FINANCE', 'Handles billing, payroll, and financial reporting', 1, 1, '2026-03-24 12:01:18', '2026-03-24 12:01:18', NULL),
(14, 'Human Resources', 'HR', 'Manages recruitment, training, and employee relations', 1, 1, '2026-03-24 12:01:18', '2026-03-24 12:01:18', NULL),
(15, 'Client Relations', 'CLIENT_REL', 'Manages client communication and onboarding', 1, 1, '2026-03-24 12:01:18', '2026-03-24 12:01:18', NULL),
(16, 'SECURITY', 'SECR', 'handling cyber and premise security.', 1, 1, '2026-03-31 12:10:32', '2026-03-31 12:10:32', NULL);

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

--
-- Table structure for table `diaries`
--

DROP TABLE IF EXISTS `diaries`;
CREATE TABLE IF NOT EXISTS `diaries` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `date_time` datetime NOT NULL,
  `task_title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `client_case` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `task_type` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `priority` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
  `status` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'pending',
  `location` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `duration` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `duration_minutes` smallint UNSIGNED DEFAULT NULL,
  `notes` text COLLATE utf8mb4_unicode_ci,
  `category_id` bigint UNSIGNED DEFAULT NULL,
  `assigned_to` bigint UNSIGNED DEFAULT NULL,
  `created_by` bigint UNSIGNED DEFAULT NULL,
  `updated_by` bigint UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `diaries_created_by_foreign` (`created_by`),
  KEY `diaries_updated_by_foreign` (`updated_by`),
  KEY `diaries_date_time_index` (`date_time`),
  KEY `diaries_status_priority_index` (`status`,`priority`),
  KEY `diaries_assigned_to_index` (`assigned_to`),
  KEY `diaries_category_id_index` (`category_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `diary_attachments`
--

DROP TABLE IF EXISTS `diary_attachments`;
CREATE TABLE IF NOT EXISTS `diary_attachments` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `diary_id` bigint UNSIGNED NOT NULL,
  `original_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `file_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `file_path` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `mime_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `file_size` bigint UNSIGNED NOT NULL,
  `file_hash` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `diary_attachments_diary_id_index` (`diary_id`),
  KEY `diary_attachments_created_at_index` (`created_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `diary_categories`
--

DROP TABLE IF EXISTS `diary_categories`;
CREATE TABLE IF NOT EXISTS `diary_categories` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `color` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `sort_order` int 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,
  PRIMARY KEY (`id`),
  UNIQUE KEY `diary_categories_name_unique` (`name`),
  KEY `diary_categories_is_active_sort_order_index` (`is_active`,`sort_order`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `diary_entry_tags`
--

DROP TABLE IF EXISTS `diary_entry_tags`;
CREATE TABLE IF NOT EXISTS `diary_entry_tags` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `diary_id` bigint UNSIGNED NOT NULL,
  `tag_id` bigint UNSIGNED NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `diary_entry_tags_diary_id_tag_id_unique` (`diary_id`,`tag_id`),
  KEY `diary_entry_tags_diary_id_index` (`diary_id`),
  KEY `diary_entry_tags_tag_id_index` (`tag_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `diary_reminders`
--

DROP TABLE IF EXISTS `diary_reminders`;
CREATE TABLE IF NOT EXISTS `diary_reminders` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `diary_id` bigint UNSIGNED NOT NULL,
  `remind_at` datetime NOT NULL,
  `is_sent` tinyint(1) NOT NULL DEFAULT '0',
  `message` text COLLATE utf8mb4_unicode_ci,
  `delivery_method` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'email',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `diary_reminders_diary_id_remind_at_index` (`diary_id`,`remind_at`),
  KEY `diary_reminders_is_sent_index` (`is_sent`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `diary_tags`
--

DROP TABLE IF EXISTS `diary_tags`;
CREATE TABLE IF NOT EXISTS `diary_tags` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `color` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `usage_count` int 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,
  PRIMARY KEY (`id`),
  UNIQUE KEY `diary_tags_name_unique` (`name`),
  KEY `diary_tags_is_active_usage_count_index` (`is_active`,`usage_count`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `features`
--

DROP TABLE IF EXISTS `features`;
CREATE TABLE IF NOT EXISTS `features` (
  `feature_id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `submodule_id` bigint UNSIGNED NOT NULL,
  `feature_name` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  PRIMARY KEY (`feature_id`),
  KEY `submodule_id` (`submodule_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `fee_arrangements`
--

DROP TABLE IF EXISTS `fee_arrangements`;
CREATE TABLE IF NOT EXISTS `fee_arrangements` (
  `arrangement_id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `matter_id` bigint UNSIGNED DEFAULT NULL,
  `case_id` bigint UNSIGNED DEFAULT NULL,
  `client_id` bigint UNSIGNED NOT NULL,
  `lawyer_id` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Responsible billing lawyer',
  `tariff_id` int DEFAULT NULL COMMENT 'Linked tariff (NULL = bespoke agreed_rate below)',
  `arrangement_type` enum('FIXED_FEE','HOURLY','CAPPED_HOURLY','RETAINER','CONTINGENCY','PRO_BONO') COLLATE utf8mb4_unicode_ci NOT NULL,
  `agreed_rate` decimal(12,2) DEFAULT NULL COMMENT 'Hourly rate or fixed fee as agreed with client',
  `fee_cap` decimal(12,2) DEFAULT NULL COMMENT 'Ceiling for CAPPED_HOURLY',
  `retainer_amount` decimal(12,2) DEFAULT NULL,
  `contingency_pct` decimal(5,2) DEFAULT NULL,
  `billing_frequency` enum('one_off','monthly','quarterly','milestone') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'one_off',
  `currency_id` bigint UNSIGNED DEFAULT NULL,
  `payment_terms_days` int NOT NULL DEFAULT '30',
  `status` enum('draft','active','suspended','closed') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'draft',
  `signed_date` date DEFAULT NULL,
  `quotation_id` bigint UNSIGNED DEFAULT NULL COMMENT 'FK → client_quotations.id if this arrangement came from a quotation',
  `notes` text COLLATE utf8mb4_unicode_ci,
  `created_by` bigint UNSIGNED DEFAULT NULL,
  `updated_by` bigint UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`arrangement_id`),
  KEY `idx_fa_matter` (`matter_id`),
  KEY `idx_fa_case` (`case_id`),
  KEY `idx_fa_client` (`client_id`),
  KEY `idx_fa_lawyer` (`lawyer_id`),
  KEY `idx_fa_tariff` (`tariff_id`),
  KEY `idx_fa_status` (`status`),
  KEY `idx_fa_quotation` (`quotation_id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Per-matter engagement agreement. Links matter/case to a tariff or bespoke rate. Quotations become arrangements on acceptance.';

--
-- Dumping data for table `fee_arrangements`
--

INSERT INTO `fee_arrangements` (`arrangement_id`, `matter_id`, `case_id`, `client_id`, `lawyer_id`, `tariff_id`, `arrangement_type`, `agreed_rate`, `fee_cap`, `retainer_amount`, `contingency_pct`, `billing_frequency`, `currency_id`, `payment_terms_days`, `status`, `signed_date`, `quotation_id`, `notes`, `created_by`, `updated_by`, `created_at`, `updated_at`) VALUES
(1, 101, NULL, 1, '1', 1, 'HOURLY', 75.00, NULL, NULL, NULL, 'one_off', 1, 30, 'active', '2026-01-05', NULL, NULL, NULL, NULL, '2026-03-27 06:17:25', '2026-03-27 06:17:25'),
(2, 102, NULL, 2, '2', 5, 'FIXED_FEE', 1200.00, NULL, NULL, NULL, 'one_off', 1, 14, 'active', '2026-01-10', 1, NULL, NULL, NULL, '2026-03-27 06:17:25', '2026-03-27 06:17:25');

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

--
-- Table structure for table `general_journals`
--

DROP TABLE IF EXISTS `general_journals`;
CREATE TABLE IF NOT EXISTS `general_journals` (
  `id` int NOT NULL AUTO_INCREMENT,
  `account_id` bigint UNSIGNED DEFAULT NULL,
  `account` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `date` date NOT NULL,
  `narration` text COLLATE utf8mb4_unicode_ci,
  `tr_code` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `currency_id` bigint UNSIGNED DEFAULT NULL,
  `transaction_code` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `currency` varchar(3) COLLATE utf8mb4_unicode_ci DEFAULT 'USD',
  `amount` decimal(15,2) NOT NULL,
  `status` enum('pending','approved','rejected','reversed') COLLATE utf8mb4_unicode_ci DEFAULT 'pending',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `transaction_code` (`transaction_code`),
  KEY `general_journals_account_id_index` (`account_id`),
  KEY `general_journals_currency_id_index` (`currency_id`)
) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `general_journals`
--

INSERT INTO `general_journals` (`id`, `account_id`, `account`, `date`, `narration`, `tr_code`, `currency_id`, `transaction_code`, `currency`, `amount`, `status`, `created_at`, `updated_at`) VALUES
(1, 10, '1000/001', '2026-01-05', 'Litigation fees earned - Whitaker Holdings Q1', 'GJ', 1, 'GJ-2026-0001', 'USD', 2500.00, 'approved', '2026-04-01 10:53:16', '2026-04-01 10:53:16'),
(2, 20, '1200/001', '2026-01-08', 'Initial consultation fee - Emily Carter contract review', 'GJ', 1, 'GJ-2026-0002', 'USD', 350.00, 'approved', '2026-04-01 10:53:16', '2026-04-01 10:53:16'),
(3, 30, '1300/002', '2026-01-12', 'High Court appearance fee - Dube Logistics litigation', 'GJ', 1, 'GJ-2026-0003', 'USD', 800.00, 'approved', '2026-04-01 10:53:16', '2026-04-01 10:53:16'),
(4, 40, '1400/003', '2026-01-15', 'Lease agreement drafted - Tendai Moyo residential property', 'GJ', 1, 'GJ-2026-0004', 'USD', 450.00, 'approved', '2026-04-01 10:53:16', '2026-04-01 10:53:16'),
(5, 50, '1500/003', '2026-01-18', 'Success fee earned - debt collection commission Chikore matter', 'GJ', 1, 'GJ-2026-0005', 'USD', 620.00, 'approved', '2026-04-01 10:53:16', '2026-04-01 10:53:16'),
(6, 80, '4000/001', '2026-01-22', 'Office rent payment - January 2026 Samora Machel Ave', 'GJ', 1, 'GJ-2026-0006', 'USD', 2800.00, 'approved', '2026-04-01 10:53:16', '2026-04-01 10:53:16'),
(7, 90, '4100/001', '2026-01-31', 'Professional staff salaries - January 2026 payroll', 'GJ', 1, 'GJ-2026-0007', 'USD', 8500.00, 'approved', '2026-04-01 10:53:16', '2026-04-01 10:53:16'),
(8, 100, '4200/001', '2026-02-03', 'Electricity consumption - January billing period', 'GJ', 1, 'GJ-2026-0008', 'USD', 415.00, 'approved', '2026-04-01 10:53:16', '2026-04-01 10:53:16'),
(9, 110, '4300/001', '2026-02-06', 'Fibre broadband - January invoice Iota Technologies', 'GJ', 1, 'GJ-2026-0009', 'USD', 280.00, 'approved', '2026-04-01 10:53:16', '2026-04-01 10:53:16'),
(10, 120, '4400/001', '2026-02-10', 'Law Society annual subscription - 2026 membership renewal', 'GJ', 1, 'GJ-2026-0010', 'USD', 480.00, 'approved', '2026-04-01 10:53:16', '2026-04-01 10:53:16'),
(11, 130, '4500/001', '2026-02-13', 'Practice management system licence - annual fee', 'GJ', 1, 'GJ-2026-0011', 'USD', 1200.00, 'approved', '2026-04-01 10:53:16', '2026-04-01 10:53:16'),
(12, 131, '4500/002', '2026-02-17', 'Accounting software licence - annual renewal', 'GJ', 1, 'GJ-2026-0012', 'USD', 650.00, 'approved', '2026-04-01 10:53:16', '2026-04-01 10:53:16'),
(13, 140, '0004/001', '2026-02-20', 'Trust account monthly bank service fee - February', 'TJ', 1, 'GJ-2026-0013', 'USD', 85.00, 'approved', '2026-04-01 10:53:16', '2026-04-01 10:53:16'),
(14, 150, '0041/002', '2026-02-24', 'Trust account audit fee - 2025 annual trust audit', 'TJ', 1, 'GJ-2026-0014', 'USD', 1800.00, 'approved', '2026-04-01 10:53:16', '2026-04-01 10:53:16'),
(15, 180, '8400/001', '2026-02-27', 'Operating account closing balance - February 2026', 'GJ', 1, 'GJ-2026-0015', 'USD', 14250.00, 'approved', '2026-04-01 10:53:16', '2026-04-01 10:53:16'),
(16, 170, '8100/001', '2026-03-01', 'Petty cash replenishment - office float top-up March', 'GJ', 1, 'GJ-2026-0016', 'USD', 500.00, 'approved', '2026-04-01 10:53:16', '2026-04-01 10:53:16'),
(17, 220, '0084/001', '2026-03-04', 'Trust current account balance - Whitaker & Dube retainers', 'TJ', 1, 'GJ-2026-0017', 'USD', 7500.00, 'approved', '2026-04-01 10:53:16', '2026-04-01 10:53:16'),
(18, 230, '0085/002', '2026-03-07', 'Trust filing float replenishment - March court season', 'TJ', 1, 'GJ-2026-0018', 'USD', 300.00, 'approved', '2026-04-01 10:53:16', '2026-04-01 10:53:16'),
(19, 160, '7100/001', '2026-03-10', 'Legal fees receivable - Mapfumo mining compliance outstanding', 'GJ', 1, 'GJ-2026-0019', 'USD', 4500.00, 'approved', '2026-04-01 10:53:16', '2026-04-01 10:53:16'),
(20, 161, '7100/002', '2026-03-13', 'Disbursements receivable - Q1 outstanding client recoveries', 'GJ', 1, 'GJ-2026-0020', 'USD', 1820.00, 'approved', '2026-04-01 10:53:16', '2026-04-01 10:53:16'),
(21, 250, '9000/001', '2026-03-16', 'Advocates payable - Farai Dube matter senior counsel brief', 'GJ', 1, 'GJ-2026-0021', 'USD', 2200.00, 'approved', '2026-04-01 10:53:16', '2026-04-01 10:53:16'),
(22, 260, '9100/001', '2026-03-19', 'Accrued salaries - March 2026 payroll provision', 'GJ', 1, 'GJ-2026-0022', 'USD', 8500.00, 'approved', '2026-04-01 10:53:16', '2026-04-01 10:53:16'),
(23, 270, '9200/001', '2026-03-22', 'VAT output - Q1 2026 legal fees billed to clients', 'GJ', 1, 'GJ-2026-0023', 'USD', 1950.00, 'approved', '2026-04-01 10:53:16', '2026-04-01 10:53:16'),
(24, 271, '9200/002', '2026-03-25', 'VAT input - Q1 2026 supplier invoices received', 'GJ', 1, 'GJ-2026-0024', 'USD', 840.00, 'approved', '2026-04-01 10:53:16', '2026-04-01 10:53:16'),
(25, 240, '0071/001', '2026-03-28', 'Client trust AR - Madondo and Mukasa outstanding trust balances', 'TJ', 1, 'GJ-2026-0025', 'USD', 6300.00, 'approved', '2026-04-01 10:53:16', '2026-04-01 10:53:16');

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

--
-- Table structure for table `general_ledger_parent_accounts`
--

DROP TABLE IF EXISTS `general_ledger_parent_accounts`;
CREATE TABLE IF NOT EXISTS `general_ledger_parent_accounts` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `account_code` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'e.g. 4000',
  `account_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'e.g. Disbursement',
  `financial_category` enum('income_statement','balance_sheet') COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Which financial statement this account belongs to',
  `account_type_id` bigint UNSIGNED NOT NULL COMMENT 'FK to account_types.id',
  `is_control_account` tinyint(1) NOT NULL DEFAULT '0',
  `is_trust_account` tinyint(1) NOT NULL DEFAULT '0',
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `created_by` bigint UNSIGNED DEFAULT NULL,
  `updated_by` bigint UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `deleted_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uq_glpa_account_code` (`account_code`),
  KEY `idx_glpa_account_type` (`account_type_id`),
  KEY `idx_glpa_financial_category` (`financial_category`)
) ENGINE=InnoDB AUTO_INCREMENT=35 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Top-level GL accounts. Each may have many sub-accounts.';

--
-- Dumping data for table `general_ledger_parent_accounts`
--

INSERT INTO `general_ledger_parent_accounts` (`id`, `account_code`, `account_name`, `financial_category`, `account_type_id`, `is_control_account`, `is_trust_account`, `is_active`, `created_by`, `updated_by`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, '1000', 'Legal Fees Income', 'income_statement', 4, 0, 0, 1, 1, 1, '2026-03-31 10:24:04', '2026-03-31 10:24:04', NULL),
(2, '1200', 'Consultation Fee', 'income_statement', 4, 0, 0, 1, 1, 1, '2026-03-31 10:24:04', '2026-03-31 10:24:04', NULL),
(3, '1300', 'Court Appearance Fees', 'income_statement', 4, 0, 0, 1, 1, 1, '2026-03-31 10:24:04', '2026-03-31 10:24:04', NULL),
(4, '1400', 'Contract Drafting Fees', 'income_statement', 4, 0, 0, 1, 1, 1, '2026-03-31 10:24:04', '2026-03-31 10:24:04', NULL),
(5, '1500', 'Commission Income', 'income_statement', 4, 0, 0, 1, 1, 1, '2026-03-31 10:24:04', '2026-03-31 10:24:04', NULL),
(6, '0005', 'Disbursements Fees', 'income_statement', 4, 0, 0, 1, 1, 1, '2026-03-31 10:24:04', '2026-03-31 10:24:04', NULL),
(7, '0001', 'Trust Interest Earned', 'income_statement', 22, 0, 1, 1, 1, 1, '2026-03-31 10:24:04', '2026-03-31 10:24:04', NULL),
(8, '4000', 'Rent', 'income_statement', 5, 0, 0, 1, 1, 1, '2026-03-31 10:24:04', '2026-03-31 10:24:04', NULL),
(9, '4100', 'Salaries & Wages', 'income_statement', 5, 0, 0, 1, 1, 1, '2026-03-31 10:24:04', '2026-03-31 10:24:04', NULL),
(10, '4200', 'Electricity & Water', 'income_statement', 5, 0, 0, 1, 1, 1, '2026-03-31 10:24:04', '2026-03-31 10:24:04', NULL),
(11, '4300', 'Internet', 'income_statement', 5, 0, 0, 1, 1, 1, '2026-03-31 10:24:04', '2026-03-31 10:24:04', NULL),
(12, '4400', 'Professional Subscription', 'income_statement', 5, 0, 0, 1, 1, 1, '2026-03-31 10:24:04', '2026-03-31 10:24:04', NULL),
(13, '4500', 'Software Licence', 'income_statement', 5, 0, 0, 1, 1, 1, '2026-03-31 10:24:04', '2026-03-31 10:24:04', NULL),
(14, '0004', 'Trust Account - Bank Charges', 'income_statement', 19, 0, 1, 1, 1, 1, '2026-03-31 10:24:04', '2026-03-31 10:24:04', NULL),
(15, '0041', 'Trust Account - Administration Fees', 'income_statement', 19, 0, 1, 1, 1, 1, '2026-03-31 10:24:04', '2026-03-31 10:24:04', NULL),
(16, '7100', 'Trade Receivable', 'balance_sheet', 13, 0, 0, 1, 1, 1, '2026-03-31 10:24:04', '2026-03-31 10:24:04', NULL),
(17, '8100', 'Petty Cash USD', 'balance_sheet', 12, 0, 0, 1, 1, 1, '2026-03-31 10:24:04', '2026-03-31 10:24:04', NULL),
(18, '8400', 'Cash USD', 'balance_sheet', 12, 0, 0, 1, 1, 1, '2026-03-31 10:24:04', '2026-03-31 10:24:04', NULL),
(19, '8500', 'Prepaid Expenses', 'balance_sheet', 9, 0, 0, 1, 1, 1, '2026-03-31 10:24:04', '2026-03-31 10:24:04', NULL),
(20, '6000', 'Motor Vehicle', 'balance_sheet', 15, 0, 0, 1, 1, 1, '2026-03-31 10:24:04', '2026-03-31 10:24:04', NULL),
(21, '6100', 'Office Equipment', 'balance_sheet', 15, 0, 0, 1, 1, 1, '2026-03-31 10:24:04', '2026-03-31 10:24:04', NULL),
(22, '0084', 'Trust Account - Cash USD', 'balance_sheet', 23, 0, 1, 1, 1, 1, '2026-03-31 10:24:04', '2026-03-31 10:24:04', NULL),
(23, '0085', 'Trust Account - Petty Cash USD', 'balance_sheet', 23, 0, 1, 1, 1, 1, '2026-03-31 10:24:04', '2026-03-31 10:24:04', NULL),
(24, '0071', 'Trust Account - Trade Receivable', 'balance_sheet', 21, 0, 1, 1, 1, 1, '2026-03-31 10:24:04', '2026-03-31 10:24:04', NULL),
(25, '9000', 'Trade Payable', 'balance_sheet', 14, 0, 0, 1, 1, 1, '2026-03-31 10:24:04', '2026-03-31 10:24:04', NULL),
(26, '9100', 'Accrued Expenses', 'balance_sheet', 10, 0, 0, 1, 1, 1, '2026-03-31 10:24:04', '2026-03-31 10:24:04', NULL),
(27, '9200', 'VAT', 'balance_sheet', 10, 0, 0, 1, 1, 1, '2026-03-31 10:24:04', '2026-03-31 10:24:04', NULL),
(28, '0091', 'Trust Account - Trade Payable', 'balance_sheet', 20, 0, 1, 1, 1, 1, '2026-03-31 10:24:04', '2026-03-31 10:24:04', NULL),
(29, '9400', 'Drawings', 'balance_sheet', 3, 0, 0, 1, 1, 1, '2026-03-31 10:24:04', '2026-03-31 10:24:04', NULL),
(30, '9500', 'Retained Earnings', 'balance_sheet', 3, 0, 0, 1, 1, 1, '2026-03-31 10:24:04', '2026-03-31 10:24:04', NULL),
(31, '9600', 'Owner Capital', 'balance_sheet', 3, 0, 0, 1, 1, 1, '2026-03-31 10:24:04', '2026-03-31 10:24:04', NULL),
(32, '5899', 'DEMO', 'income_statement', 5, 1, 0, 1, 1, 1, '2026-03-31 12:46:20', '2026-03-31 12:46:20', NULL),
(34, '2510', 'MELSOFT', 'balance_sheet', 8, 1, 0, 1, 1, 1, '2026-03-31 13:04:09', '2026-03-31 13:04:09', NULL);

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

--
-- Table structure for table `general_ledger_subaccounts`
--

DROP TABLE IF EXISTS `general_ledger_subaccounts`;
CREATE TABLE IF NOT EXISTS `general_ledger_subaccounts` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `parent_id` bigint UNSIGNED NOT NULL COMMENT 'FK to general_ledger_parent_accounts.id',
  `sub_code` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Suffix only e.g. 100, 101',
  `account_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'e.g. Transport Fee',
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `created_by` bigint UNSIGNED DEFAULT NULL,
  `updated_by` bigint UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `deleted_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uq_glsa_parent_sub_code` (`parent_id`,`sub_code`),
  KEY `idx_glsa_parent_id` (`parent_id`)
) ENGINE=InnoDB AUTO_INCREMENT=316 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Sub-accounts linked to a parent. Full code displayed as parent_code/sub_code.';

--
-- Dumping data for table `general_ledger_subaccounts`
--

INSERT INTO `general_ledger_subaccounts` (`id`, `parent_id`, `sub_code`, `account_name`, `is_active`, `created_by`, `updated_by`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 20, '100', 'Motor Vehicle @ Cost', 1, 1, 1, '2026-03-06 13:53:20', '2026-03-06 13:53:20', NULL),
(2, 20, '101', 'Motor Vehicle - Acc Depreciation', 1, 1, 1, '2026-03-06 13:54:02', '2026-03-06 13:54:02', NULL),
(3, 21, '100', 'Office Equipment @ Cost', 1, 1, 1, '2026-03-06 13:54:52', '2026-03-06 13:54:52', NULL),
(4, 21, '101', 'Office Equipment - Acc Depreciation', 1, 1, 1, '2026-03-06 13:55:14', '2026-03-06 13:55:14', NULL),
(5, 6, '001', 'Filing Fees', 1, 1, 1, '2026-03-07 00:00:14', '2026-03-07 00:00:14', NULL),
(6, 6, '002', 'Sheriff Fees', 1, 1, 1, '2026-03-07 00:00:35', '2026-03-07 00:00:35', NULL),
(7, 6, '003', 'Advocate Fees', 1, 1, 1, '2026-03-07 00:00:52', '2026-03-07 00:00:52', NULL),
(8, 6, '004', 'Courier Fees', 1, 1, 1, '2026-03-07 00:01:36', '2026-03-07 00:01:36', NULL),
(10, 1, '001', 'Litigation Fees', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(11, 1, '002', 'Advisory Fees', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(12, 1, '003', 'Drafting Fees', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(13, 1, '004', 'Compliance Fees', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(14, 1, '005', 'General Legal Fees', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(20, 2, '001', 'Initial Consultation', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(21, 2, '002', 'Follow-Up Consultation', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(22, 2, '003', 'Telephone Consultation', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(23, 2, '004', 'Written Legal Opinion', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(24, 2, '005', 'Urgent Consultation', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(30, 3, '001', 'Magistrates Court', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(31, 3, '002', 'High Court', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(32, 3, '003', 'Supreme Court of Appeal', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(33, 3, '004', 'Constitutional Court', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(34, 3, '005', 'Urgent Chamber Application', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(40, 4, '001', 'Commercial Contracts', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(41, 4, '002', 'Employment Contracts', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(42, 4, '003', 'Lease Agreements', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(43, 4, '004', 'Settlement Agreements', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(44, 4, '005', 'Non-Disclosure Agreements', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(50, 5, '001', 'Referral Commission', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(51, 5, '002', 'Agency Commission', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(52, 5, '003', 'Success Fee', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(53, 5, '004', 'Brokerage Fee', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(54, 5, '005', 'Debt Collection Commission', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(70, 7, '001', 'Trust Savings Interest', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(71, 7, '002', 'Trust Investment Interest', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(72, 7, '003', 'Trust Call Account Interest', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(73, 7, '004', 'Trust Fixed Deposit Interest', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(74, 7, '005', 'Trust Money Market Interest', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(80, 8, '001', 'Office Rent', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(81, 8, '002', 'Parking', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(82, 8, '003', 'Storage / Archive Room', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(83, 8, '004', 'Boardroom Hire', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(84, 8, '005', 'Satellite Office Rent', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(90, 9, '001', 'Professional Staff Salaries', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(91, 9, '002', 'Support Staff Salaries', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(92, 9, '003', 'Overtime', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(93, 9, '004', 'Bonuses & Incentives', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(94, 9, '005', 'Casual Labour', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(100, 10, '001', 'Electricity', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(101, 10, '002', 'Water & Sewerage', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(102, 10, '003', 'Refuse Removal', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(103, 10, '004', 'Municipal Rates', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(104, 10, '005', 'Solar / Generator Levy', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(110, 11, '001', 'Fibre / Broadband', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(111, 11, '002', 'Backup LTE / Mobile Data', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(112, 11, '003', 'VOIP / Telephone Lines', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(113, 11, '004', 'Domain & Website Hosting', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(114, 11, '005', 'IT Support & Maintenance', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(120, 12, '001', 'Law Society Subscription', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(121, 12, '002', 'Bar Council Subscription', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(122, 12, '003', 'Legal Journals & Reports', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(123, 12, '004', 'CPD Training & Seminars', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(124, 12, '005', 'Professional Indemnity', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(130, 13, '001', 'Practice Management System', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(131, 13, '002', 'Accounting Software', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(132, 13, '003', 'MS Office / Productivity', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(133, 13, '004', 'Legal Research Platform', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(134, 13, '005', 'Cloud Backup & Storage', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(140, 14, '001', 'Monthly Service Fee', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(141, 14, '002', 'Transaction Charges', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(142, 14, '003', 'Cash Handling Fees', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(143, 14, '004', 'Electronic Transfer Fees', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(144, 14, '005', 'Cheque Processing Fees', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(150, 15, '001', 'Trust Account Setup Fee', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(151, 15, '002', 'Trust Audit Fee', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(152, 15, '003', 'Trust Compliance Fee', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(153, 15, '004', 'Trust Reporting Fee', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(154, 15, '005', 'Trust Management Fee', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(160, 16, '001', 'Legal Fees Receivable', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(161, 16, '002', 'Disbursements Receivable', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(162, 16, '003', 'VAT Receivable', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(163, 16, '004', 'Retainer Deposits', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(164, 16, '005', 'Other Receivables', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(170, 17, '001', 'Office Petty Cash', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(171, 17, '002', 'Courier Float', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(172, 17, '003', 'Postage Float', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(173, 17, '004', 'Sundry Cash Float', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(174, 17, '005', 'Court Filing Float', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(180, 18, '001', 'Main Operating Account', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(181, 18, '002', 'Payroll Account', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(182, 18, '003', 'Savings Account', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(183, 18, '004', 'Foreign Currency Account', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(184, 18, '005', 'Cash on Hand', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(190, 19, '001', 'Prepaid Rent', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(191, 19, '002', 'Prepaid Insurance', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(192, 19, '003', 'Prepaid Subscriptions', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(193, 19, '004', 'Prepaid IT Contracts', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(194, 19, '005', 'Prepaid Retainer Costs', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(220, 22, '001', 'Trust Current Account', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(221, 22, '002', 'Trust Savings Account', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(222, 22, '003', 'Trust Call Account', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(223, 22, '004', 'Trust Investment Account', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(224, 22, '005', 'Trust Money Market Account', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(230, 23, '001', 'Trust Postage Float', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(231, 23, '002', 'Trust Filing Float', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(232, 23, '003', 'Trust Courier Float', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(233, 23, '004', 'Trust Sundry Float', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(234, 23, '005', 'Trust Admin Float', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(240, 24, '001', 'Client Trust AR', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(241, 24, '002', 'Trust Disbursement Recoveries', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(242, 24, '003', 'Trust Interest Receivable', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(243, 24, '004', 'Trust Levy Receivable', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(244, 24, '005', 'Other Trust Receivables', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(250, 25, '001', 'Advocates Payable', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(251, 25, '002', 'Supplier Invoices Payable', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(252, 25, '003', 'Court Fees Payable', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(253, 25, '004', 'Counsel Fees Payable', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(254, 25, '005', 'Other Payables', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(260, 26, '001', 'Accrued Salaries', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(261, 26, '002', 'Accrued Audit Fees', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(262, 26, '003', 'Accrued Leave Pay', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(263, 26, '004', 'Accrued Interest', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(264, 26, '005', 'Accrued Legal Costs', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(270, 27, '001', 'VAT Output', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(271, 27, '002', 'VAT Input', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(272, 27, '003', 'VAT Control Account', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(273, 27, '004', 'VAT Penalties', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(274, 27, '005', 'VAT Interest', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(280, 28, '001', 'Trust Creditors', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(281, 28, '002', 'Trust Advocate Fees Payable', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(282, 28, '003', 'Trust Disbursement Payable', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(283, 28, '004', 'Trust Levy Payable', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(284, 28, '005', 'Other Trust Payables', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(290, 29, '001', 'Partner Drawings', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(291, 29, '002', 'Director Drawings', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(292, 29, '003', 'Shareholder Drawings', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(293, 29, '004', 'Interim Drawings', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(294, 29, '005', 'Year-End Drawings', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(300, 30, '001', 'Opening Retained Earnings', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(301, 30, '002', 'Current Year Earnings', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(302, 30, '003', 'Prior Year Adjustment', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(303, 30, '004', 'Dividend Reserve', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(304, 30, '005', 'General Reserve', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(310, 31, '001', 'Initial Capital Contribution', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(311, 31, '002', 'Additional Capital Contribution', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(312, 31, '003', 'Capital Reserve', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(313, 31, '004', 'Revaluation Reserve', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(314, 31, '005', 'Partner Capital Account', 1, 1, 1, '2026-03-31 10:42:08', '2026-03-31 10:42:08', NULL),
(315, 32, '100', 'DEMO 44', 1, 1, 1, '2026-03-31 13:01:17', '2026-03-31 13:01:17', NULL);

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

--
-- Table structure for table `group_calls`
--

DROP TABLE IF EXISTS `group_calls`;
CREATE TABLE IF NOT EXISTS `group_calls` (
  `call_id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `chat_id` bigint UNSIGNED NOT NULL,
  `initiated_by` bigint UNSIGNED NOT NULL,
  `call_type` enum('audio','video') COLLATE utf8mb4_unicode_ci NOT NULL,
  `status` enum('ongoing','ended','missed') COLLATE utf8mb4_unicode_ci DEFAULT 'ongoing',
  `started_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `ended_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`call_id`),
  KEY `chat_id` (`chat_id`),
  KEY `initiated_by` (`initiated_by`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `group_call_participants`
--

DROP TABLE IF EXISTS `group_call_participants`;
CREATE TABLE IF NOT EXISTS `group_call_participants` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `call_id` bigint UNSIGNED NOT NULL,
  `user_id` bigint UNSIGNED NOT NULL,
  `join_time` timestamp NULL DEFAULT NULL,
  `leave_time` timestamp NULL DEFAULT NULL,
  `call_status` enum('joined','missed','left') COLLATE utf8mb4_unicode_ci DEFAULT 'missed',
  PRIMARY KEY (`id`),
  KEY `call_id` (`call_id`),
  KEY `user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `group_permissions`
--

DROP TABLE IF EXISTS `group_permissions`;
CREATE TABLE IF NOT EXISTS `group_permissions` (
  `group_permission_id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `group_id` bigint UNSIGNED NOT NULL,
  `feature_id` bigint UNSIGNED NOT NULL,
  `can_view` tinyint(1) NOT NULL DEFAULT '0',
  `can_add` tinyint(1) NOT NULL DEFAULT '0',
  `can_edit` tinyint(1) NOT NULL DEFAULT '0',
  `can_delete` tinyint(1) NOT NULL DEFAULT '0',
  `can_export` tinyint(1) NOT NULL DEFAULT '0',
  `can_print` tinyint(1) NOT NULL DEFAULT '0',
  `can_approve` tinyint(1) NOT NULL DEFAULT '0',
  `created_by` bigint UNSIGNED NOT NULL,
  `updated_by` bigint UNSIGNED DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`group_permission_id`),
  UNIQUE KEY `uq_group_feature` (`group_id`,`feature_id`),
  KEY `fk_group_perm_feature` (`feature_id`),
  KEY `fk_group_perm_created_by` (`created_by`),
  KEY `fk_group_perm_updated_by` (`updated_by`)
) ENGINE=InnoDB AUTO_INCREMENT=185 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `group_permissions`
--

INSERT INTO `group_permissions` (`group_permission_id`, `group_id`, `feature_id`, `can_view`, `can_add`, `can_edit`, `can_delete`, `can_export`, `can_print`, `can_approve`, `created_by`, `updated_by`, `created_at`, `updated_at`) VALUES
(1, 1, 2, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(2, 1, 46, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(3, 1, 17, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(4, 1, 35, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(5, 1, 26, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(6, 1, 11, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(7, 1, 22, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(8, 1, 24, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(9, 1, 4, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(10, 1, 39, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(11, 1, 42, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(12, 1, 41, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(13, 1, 40, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(14, 1, 20, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(15, 1, 25, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(16, 1, 9, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(17, 1, 12, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(18, 1, 19, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(19, 1, 27, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(20, 1, 13, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(21, 1, 3, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(22, 1, 18, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(23, 1, 31, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(24, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(25, 1, 38, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(26, 1, 34, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(27, 1, 23, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(28, 1, 37, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(29, 1, 15, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(30, 1, 14, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(31, 1, 28, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(32, 1, 10, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(33, 1, 43, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(34, 1, 6, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(35, 1, 32, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(36, 1, 5, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(37, 1, 21, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(38, 1, 29, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(39, 1, 8, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(40, 1, 45, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(41, 1, 16, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(42, 1, 30, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(43, 1, 7, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(44, 1, 33, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(45, 1, 36, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(46, 1, 44, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(47, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(48, 2, 46, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(49, 2, 17, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(50, 2, 35, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(51, 2, 26, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(52, 2, 11, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(53, 2, 22, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(54, 2, 24, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(55, 2, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(56, 2, 39, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(57, 2, 42, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(58, 2, 41, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(59, 2, 40, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(60, 2, 20, 1, 1, 1, 0, 1, 1, 1, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(61, 2, 25, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(62, 2, 9, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(63, 2, 12, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(64, 2, 19, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(65, 2, 27, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(66, 2, 13, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(67, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(68, 2, 18, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(69, 2, 31, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(70, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(71, 2, 38, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(72, 2, 34, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(73, 2, 23, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(74, 2, 37, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(75, 2, 15, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(76, 2, 14, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(77, 2, 28, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(78, 2, 10, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(79, 2, 43, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(80, 2, 6, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(81, 2, 32, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(82, 2, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(83, 2, 21, 1, 1, 1, 0, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(84, 2, 29, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(85, 2, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(86, 2, 45, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(87, 2, 16, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(88, 2, 30, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(89, 2, 7, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(90, 2, 33, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(91, 2, 36, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(92, 2, 44, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(93, 3, 2, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(94, 3, 46, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(95, 3, 17, 1, 1, 1, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(96, 3, 35, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(97, 3, 26, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(98, 3, 11, 1, 1, 1, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(99, 3, 22, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(100, 3, 24, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(101, 3, 4, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(102, 3, 39, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(103, 3, 42, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(104, 3, 41, 1, 1, 1, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(105, 3, 40, 1, 1, 1, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(106, 3, 20, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(107, 3, 25, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(108, 3, 9, 1, 1, 1, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(109, 3, 12, 1, 1, 1, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(110, 3, 19, 1, 1, 1, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(111, 3, 27, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(112, 3, 13, 1, 1, 1, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(113, 3, 3, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(114, 3, 18, 1, 1, 1, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(115, 3, 31, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(116, 3, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(117, 3, 38, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(118, 3, 34, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(119, 3, 23, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(120, 3, 37, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(121, 3, 15, 1, 1, 1, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(122, 3, 14, 1, 1, 1, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(123, 3, 28, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(124, 3, 10, 1, 1, 1, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(125, 3, 43, 1, 1, 1, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(126, 3, 6, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(127, 3, 32, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(128, 3, 5, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(129, 3, 21, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(130, 3, 29, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(131, 3, 8, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(132, 3, 45, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(133, 3, 16, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(134, 3, 30, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(135, 3, 7, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(136, 3, 33, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(137, 3, 36, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(138, 3, 44, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(139, 4, 2, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(140, 4, 46, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(141, 4, 17, 1, 1, 1, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(142, 4, 35, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(143, 4, 26, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(144, 4, 11, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(145, 4, 22, 1, 1, 1, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(146, 4, 24, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(147, 4, 4, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(148, 4, 39, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(149, 4, 42, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(150, 4, 41, 1, 1, 1, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(151, 4, 40, 1, 1, 1, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(152, 4, 20, 1, 1, 1, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(153, 4, 25, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(154, 4, 9, 1, 1, 1, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(155, 4, 12, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(156, 4, 19, 1, 1, 1, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(157, 4, 27, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(158, 4, 13, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(159, 4, 3, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(160, 4, 18, 1, 1, 1, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(161, 4, 31, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(162, 4, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(163, 4, 38, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(164, 4, 34, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(165, 4, 23, 1, 1, 1, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(166, 4, 37, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(167, 4, 15, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(168, 4, 14, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(169, 4, 28, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(170, 4, 10, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(171, 4, 43, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(172, 4, 6, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(173, 4, 32, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(174, 4, 5, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(175, 4, 21, 1, 1, 1, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(176, 4, 29, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(177, 4, 8, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(178, 4, 45, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(179, 4, 16, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(180, 4, 30, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(181, 4, 7, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(182, 4, 33, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(183, 4, 36, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(184, 4, 44, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48');

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

--
-- Table structure for table `home_currency`
--

DROP TABLE IF EXISTS `home_currency`;
CREATE TABLE IF NOT EXISTS `home_currency` (
  `home_currency_id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `currency_id` bigint UNSIGNED NOT NULL,
  `effective_date` date DEFAULT NULL,
  `is_active` tinyint(1) DEFAULT '1',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`home_currency_id`),
  KEY `currency_id` (`currency_id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `home_currency`
--

INSERT INTO `home_currency` (`home_currency_id`, `currency_id`, `effective_date`, `is_active`, `created_at`, `updated_at`) VALUES
(1, 1, '2026-01-27', 1, '2026-01-05 07:04:25', '2026-01-27 11:59:03');

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

--
-- Table structure for table `home_currency_history`
--

DROP TABLE IF EXISTS `home_currency_history`;
CREATE TABLE IF NOT EXISTS `home_currency_history` (
  `history_id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `currency_id` bigint UNSIGNED NOT NULL,
  `effective_date` date DEFAULT NULL,
  `deactivated_date` date DEFAULT NULL,
  `changed_by` bigint UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`history_id`),
  KEY `currency_id` (`currency_id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `home_currency_history`
--

INSERT INTO `home_currency_history` (`history_id`, `currency_id`, `effective_date`, `deactivated_date`, `changed_by`, `created_at`) VALUES
(1, 2, '2026-01-05', '2026-01-27', 1, '2026-01-27 13:59:03');

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

--
-- Table structure for table `journal_headers`
--

DROP TABLE IF EXISTS `journal_headers`;
CREATE TABLE IF NOT EXISTS `journal_headers` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `journal_date` date NOT NULL,
  `reference` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `description` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `source_module` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_by` bigint UNSIGNED DEFAULT NULL,
  `updated_by` bigint UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `journal_headers_created_by_foreign` (`created_by`),
  KEY `journal_headers_updated_by_foreign` (`updated_by`),
  KEY `journal_headers_journal_date_index` (`journal_date`)
) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `journal_headers`
--

INSERT INTO `journal_headers` (`id`, `journal_date`, `reference`, `description`, `source_module`, `created_by`, `updated_by`, `created_at`, `updated_at`) VALUES
(11, '2026-03-25', 'deposit', 'money entering', 'cashbook', 1, 1, '2026-03-25 10:00:07', '2026-03-25 10:00:07'),
(12, '2026-03-25', 'DEPOSIT', 'deposit for matter fees', 'cashbook', 1, 1, '2026-03-25 11:10:33', '2026-03-25 11:10:33'),
(13, '2026-01-05', 'TRF-2026-001', 'Retainer deposit received - Whitaker Holdings corporate advisory', 'cashbook', 1, 1, '2026-04-01 12:52:13', '2026-04-01 12:52:13'),
(14, '2026-01-18', 'TRF-2026-002', 'Filing fees paid from trust - High Court Dube Logistics', 'cashbook', 1, 1, '2026-04-01 12:52:13', '2026-04-01 12:52:13'),
(15, '2026-02-03', 'TRF-2026-003', 'Retainer deposit received - Mapfumo mining compliance RioZim', 'cashbook', 1, 1, '2026-04-01 12:52:13', '2026-04-01 12:52:13'),
(16, '2026-02-14', 'TRF-2026-004', 'Advocate fees paid from trust - Chikore labour court brief', 'cashbook', 1, 1, '2026-04-01 12:52:13', '2026-04-01 12:52:13'),
(17, '2026-02-24', 'TRF-2026-005', 'Trust interest credited - Q1 client fund balances', 'cashbook', 1, 1, '2026-04-01 12:52:13', '2026-04-01 12:52:13'),
(18, '2026-03-01', 'TRF-2026-006', 'Retainer deposit received - Madondo ZISCO Steel compliance', 'cashbook', 1, 1, '2026-04-01 12:52:13', '2026-04-01 12:52:13'),
(19, '2026-03-10', 'TRF-2026-007', 'Sheriff fees paid from trust - Muchengeti workplace grievance', 'cashbook', 1, 1, '2026-04-01 12:52:13', '2026-04-01 12:52:13'),
(20, '2026-03-15', 'TRF-2026-008', 'Trust petty cash replenishment - court filing season float', 'cashbook', 1, 1, '2026-04-01 12:52:13', '2026-04-01 12:52:13'),
(21, '2026-03-22', 'TRF-2026-009', 'Retainer deposit received - Mukasa Engineering regulatory matter', 'cashbook', 1, 1, '2026-04-01 12:52:13', '2026-04-01 12:52:13'),
(22, '2026-03-28', 'TRF-2026-010', 'Trust admin fees charged - Gwena AG HNWI cross-border advisory', 'cashbook', 1, 1, '2026-04-01 12:52:13', '2026-04-01 12:52:13'),
(23, '2026-01-02', 'BUS-2026-001', 'Legal fees received - Emily Carter contract review consultation', 'cashbook', 1, 1, '2026-04-01 12:52:13', '2026-04-01 12:52:13'),
(24, '2026-01-15', 'BUS-2026-002', 'Office rent payment January 2026 - Samora Machel Ave', 'cashbook', 1, 1, '2026-04-01 12:52:13', '2026-04-01 12:52:13'),
(25, '2026-01-31', 'BUS-2026-003', 'Salaries payment January 2026 - professional and support staff', 'cashbook', 1, 1, '2026-04-01 12:52:13', '2026-04-01 12:52:13'),
(26, '2026-02-05', 'BUS-2026-004', 'Consultation fee received - Katsande tender advisory', 'cashbook', 1, 1, '2026-04-01 12:52:13', '2026-04-01 12:52:13'),
(27, '2026-02-12', 'BUS-2026-005', 'Petty cash payment - office stationery and sundry supplies', 'cashbook', 1, 1, '2026-04-01 12:52:13', '2026-04-01 12:52:13'),
(28, '2026-02-20', 'BUS-2026-006', 'Internet and VOIP invoice paid - Iota Technologies February', 'cashbook', 1, 1, '2026-04-01 12:52:13', '2026-04-01 12:52:13'),
(29, '2026-02-28', 'BUS-2026-007', 'Commission income received - debt collection success fee Chikore', 'cashbook', 1, 1, '2026-04-01 12:52:13', '2026-04-01 12:52:13'),
(30, '2026-03-05', 'BUS-2026-008', 'Office rent payment March 2026 - Samora Machel Ave', 'cashbook', 1, 1, '2026-04-01 12:52:13', '2026-04-01 12:52:13'),
(31, '2026-03-14', 'BUS-2026-009', 'Software licence payment - practice management system annual', 'cashbook', 1, 1, '2026-04-01 12:52:13', '2026-04-01 12:52:13'),
(32, '2026-03-25', 'BUS-2026-010', 'Court appearance fees received - Ncube High Court matter', 'cashbook', 1, 1, '2026-04-01 12:52:13', '2026-04-01 12:52:13'),
(33, '2026-01-20', 'TRX-2026-001', 'Transfer from trust to business - Whitaker fees earned release', 'cashbook', 1, 1, '2026-04-01 12:52:13', '2026-04-01 12:52:13'),
(34, '2026-02-10', 'TRX-2026-002', 'Transfer from trust to business - Dube retainer release on billing', 'cashbook', 1, 1, '2026-04-01 12:52:13', '2026-04-01 12:52:13'),
(35, '2026-02-26', 'TRX-2026-003', 'Transfer from trust - Mapfumo mining compliance fees released', 'cashbook', 1, 1, '2026-04-01 12:52:13', '2026-04-01 12:52:13'),
(36, '2026-03-18', 'TRX-2026-004', 'Transfer from trust to business - Madondo matter fees earned', 'cashbook', 1, 1, '2026-04-01 12:52:13', '2026-04-01 12:52:13'),
(37, '2026-03-30', 'TRX-2026-005', 'Transfer from trust to business - Q1 retainer reconciliation release', 'cashbook', 1, 1, '2026-04-01 12:52:13', '2026-04-01 12:52:13');

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

--
-- Table structure for table `journal_lines`
--

DROP TABLE IF EXISTS `journal_lines`;
CREATE TABLE IF NOT EXISTS `journal_lines` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `journal_header_id` bigint UNSIGNED NOT NULL,
  `gl_account_id` bigint UNSIGNED NOT NULL,
  `debit` decimal(15,2) NOT NULL DEFAULT '0.00',
  `credit` decimal(15,2) NOT NULL DEFAULT '0.00',
  `description` text COLLATE utf8mb4_unicode_ci,
  `department_id` bigint UNSIGNED DEFAULT NULL,
  `created_by` bigint UNSIGNED DEFAULT NULL,
  `updated_by` bigint UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `journal_lines_created_by_foreign` (`created_by`),
  KEY `journal_lines_updated_by_foreign` (`updated_by`),
  KEY `journal_lines_journal_header_id_index` (`journal_header_id`),
  KEY `journal_lines_gl_account_id_index` (`gl_account_id`),
  KEY `journal_lines_department_id_index` (`department_id`)
) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `journal_lines`
--

INSERT INTO `journal_lines` (`id`, `journal_header_id`, `gl_account_id`, `debit`, `credit`, `description`, `department_id`, `created_by`, `updated_by`, `created_at`, `updated_at`) VALUES
(21, 11, 11, 1000.00, 0.00, 'money entering', NULL, 1, 1, '2026-03-25 10:00:07', '2026-03-25 10:00:07'),
(22, 11, 3, 0.00, 1000.00, 'money entering', NULL, 1, 1, '2026-03-25 10:00:07', '2026-03-25 10:00:07'),
(23, 12, 9, 500.50, 0.00, 'deposit for matter fees', NULL, 1, 1, '2026-03-25 11:10:33', '2026-03-25 11:10:33'),
(24, 12, 9, 0.00, 500.50, 'deposit for matter fees', NULL, 1, 1, '2026-03-25 11:10:33', '2026-03-25 11:10:33');

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

--
-- Table structure for table `journal_transactions`
--

DROP TABLE IF EXISTS `journal_transactions`;
CREATE TABLE IF NOT EXISTS `journal_transactions` (
  `id` int NOT NULL AUTO_INCREMENT,
  `transaction_code` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `journal_type` enum('general','client','supplier') COLLATE utf8mb4_unicode_ci NOT NULL,
  `journal_id` int NOT NULL,
  `date` date NOT NULL,
  `amount` decimal(15,2) NOT NULL,
  `status` enum('pending','approved','rejected','reversed') COLLATE utf8mb4_unicode_ci DEFAULT 'pending',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `transaction_code` (`transaction_code`),
  KEY `idx_journal_type` (`journal_type`,`journal_id`),
  KEY `idx_transaction_code` (`transaction_code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `judgements`
--

DROP TABLE IF EXISTS `judgements`;
CREATE TABLE IF NOT EXISTS `judgements` (
  `judgement_id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `judgement_code` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
  `title` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`judgement_id`),
  UNIQUE KEY `judgement_code` (`judgement_code`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `judgements`
--

INSERT INTO `judgements` (`judgement_id`, `judgement_code`, `title`, `description`, `created_at`, `updated_at`) VALUES
(1, 'JDG-FIN', 'Final Judgment', 'Conclusive determination of the case on its merits', '2026-03-27 06:43:31', '2026-03-27 06:43:31'),
(2, 'JDG-INT', 'Interlocutory Judgment', 'Decision on an interim matter before final resolution', '2026-03-27 06:43:31', '2026-03-27 06:43:31'),
(3, 'JDG-DEF', 'Default Judgment', 'Judgment entered due to failure of a party to appear or respond', '2026-03-27 06:43:31', '2026-03-27 06:43:31'),
(4, 'JDG-SUM', 'Summary Judgment', 'Judgment given where no triable issues of fact exist', '2026-03-27 06:43:31', '2026-03-27 06:43:31'),
(5, 'JDG-CON', 'Consent Judgment', 'Judgment entered with agreement of all parties', '2026-03-27 06:43:31', '2026-03-27 06:43:31'),
(6, 'JDG-DEC', 'Declaratory Judgment', 'Judgment declaring rights without awarding damages', '2026-03-27 06:43:31', '2026-03-27 06:43:31'),
(7, 'JDG-MAN', 'Mandatory Order', 'Judgment compelling a party to perform a specific act', '2026-03-27 06:43:31', '2026-03-27 06:43:31'),
(8, 'JDG-PRO', 'Prohibitory Order', 'Judgment restraining a party from certain actions', '2026-03-27 06:43:31', '2026-03-27 06:43:31'),
(9, 'JDG-COS', 'Costs Order', 'Judgment determining liability for legal costs', '2026-03-27 06:43:31', '2026-03-27 06:43:31'),
(10, 'JDG-DIS', 'Dismissal Judgment', 'Judgment dismissing a case or application', '2026-03-27 06:43:31', '2026-03-27 06:43:31');

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

--
-- Table structure for table `judges`
--

DROP TABLE IF EXISTS `judges`;
CREATE TABLE IF NOT EXISTS `judges` (
  `judge_id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `judge_code` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
  `full_name` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
  `court_area_code` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `court_type_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `contact` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `email` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `status` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT 'Active',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `notes` text COLLATE utf8mb4_unicode_ci,
  `is_active` tinyint(1) DEFAULT '1',
  PRIMARY KEY (`judge_id`),
  UNIQUE KEY `judge_code` (`judge_code`),
  KEY `court_area_code` (`court_area_code`),
  KEY `court_type_name` (`court_type_name`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `judges`
--

INSERT INTO `judges` (`judge_id`, `judge_code`, `full_name`, `court_area_code`, `court_type_name`, `contact`, `email`, `status`, `created_at`, `updated_at`, `notes`, `is_active`) VALUES
(1, 'JDG-001', 'Justice Tendai Moyo', 'CA-HHC', 'High Court', '+263771234001', 'tendai.moyo@judiciary.co.zw', 'Active', '2026-03-27 06:43:31', '2026-03-27 06:43:31', 'Senior High Court Judge', 1),
(2, 'JDG-002', 'Justice Nomsa Dube', 'CA-BHC', 'High Court', '+263771234002', 'nomsa.dube@judiciary.co.zw', 'Active', '2026-03-27 06:43:31', '2026-03-27 06:43:31', 'Experienced in criminal law', 1),
(3, 'JDG-003', 'Justice Farai Chikore', 'CA-HRE', 'Magistrates Court', '+263771234003', 'farai.chikore@judiciary.co.zw', 'Active', '2026-03-27 06:43:31', '2026-03-27 06:43:31', 'Handles civil matters', 1),
(4, 'JDG-004', 'Justice Tapiwa Nyathi', 'CA-GWE', 'Magistrates Court', '+263771234004', 'tapiwa.nyathi@judiciary.co.zw', 'Active', '2026-03-27 06:43:31', '2026-03-27 06:43:31', 'Midlands Province', 1),
(5, 'JDG-005', 'Justice Rudo Mapfumo', 'CA-MUT', 'Magistrates Court', '+263771234005', 'rudo.mapfumo@judiciary.co.zw', 'On Leave', '2026-03-27 06:43:31', '2026-03-27 06:43:31', 'Currently on study leave', 1),
(6, 'JDG-006', 'Justice Blessing Hove', 'CA-BYO', 'Magistrates Court', '+263771234006', 'blessing.hove@judiciary.co.zw', 'Active', '2026-03-27 06:43:31', '2026-03-27 06:43:31', 'Commercial disputes focus', 1),
(7, 'JDG-007', 'Justice Wellington Ncube', 'CA-MAS', 'Magistrates Court', '+263771234007', 'wellington.ncube@judiciary.co.zw', 'Active', '2026-03-27 06:43:31', '2026-03-27 06:43:31', 'Southern circuit', 1),
(8, 'JDG-008', 'Justice Chipo Katsande', 'CA-CHI', 'Magistrates Court', '+263771234008', 'chipo.katsande@judiciary.co.zw', 'Suspended', '2026-03-27 06:43:31', '2026-03-27 06:43:31', 'Under administrative review', 0),
(9, 'JDG-009', 'Justice Tawanda Muzenda', 'CA-MAR', 'Magistrates Court', '+263771234009', 'tawanda.muzenda@judiciary.co.zw', 'Active', '2026-03-27 06:43:31', '2026-03-27 06:43:31', 'Land dispute specialist', 1),
(10, 'JDG-010', 'Justice Nkosana Sibanda', 'CA-VIC', 'Magistrates Court', '+263771234010', 'nkosana.sibanda@judiciary.co.zw', 'Active', '2026-03-27 06:43:31', '2026-03-27 06:43:31', 'Matabeleland North circuit', 1);

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

--
-- Table structure for table `lawyers`
--

DROP TABLE IF EXISTS `lawyers`;
CREATE TABLE IF NOT EXISTS `lawyers` (
  `lawyer_id` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
  `first_name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `last_name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `phone_primary` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
  `phone_secondary` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `lawyer_group` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `certificate_number` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `date_of_admission` date DEFAULT NULL,
  `status` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT 'Active',
  `lawyer_type` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `lawyer_tier` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `notes` text COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `tier_id` int DEFAULT NULL,
  PRIMARY KEY (`lawyer_id`),
  UNIQUE KEY `email` (`email`),
  KEY `fk_lawyer_tier` (`tier_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `lawyers`
--

INSERT INTO `lawyers` (`lawyer_id`, `first_name`, `last_name`, `email`, `phone_primary`, `phone_secondary`, `lawyer_group`, `certificate_number`, `date_of_admission`, `status`, `lawyer_type`, `lawyer_tier`, `notes`, `created_at`, `updated_at`, `tier_id`) VALUES
('1', 'Alice', 'Moyo', 'alice.moyo@wayne.enterprises.com', '+263772000001', '+263772000101', 'Civil Law', 'CERT001', '2018-05-15', 'ACTIVE', 'Contract Lawyer', 'Junior Associate', 'Specializes in commercial contracts', '2026-01-05 15:06:25', '2026-01-05 15:06:25', 1),
('2', 'Brian', 'Chikore', 'brian.chikore@wayne.enterprises.com', '+263772000002', '+263772000102', 'Family Law', 'CERT002', '2016-08-20', 'ACTIVE', 'Divorce Lawyer', 'Associate', 'Handles divorce and custody cases', '2026-01-05 15:06:25', '2026-01-05 15:06:25', 2),
('3', 'Clara', 'Mabhena', 'clara.mabhena@wayne.enterprises.com', '+263772000003', '+263772000103', 'Criminal Law', 'CERT003', '2012-11-30', 'ACTIVE', 'Criminal Defence Lawyer', 'Senior Associate', 'Experienced in criminal litigation', '2026-01-05 15:06:25', '2026-01-05 15:06:25', 3),
('L200861', 'Tadiwa', 'Gwena', 'tadiwagwena@gmail.com', '0777367773', NULL, '12', NULL, NULL, 'Active', 'Mining Rights Lawyer', NULL, NULL, '2026-01-06 07:36:48', '2026-01-06 08:01:53', NULL),
('L940147', 'ash', 'Gwena', 'lol@lol.com', '00000000', NULL, NULL, NULL, NULL, 'Active', 'Tax Advisory Lawyer', NULL, NULL, '2026-01-06 07:49:45', '2026-01-06 07:54:49', NULL);

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

--
-- Table structure for table `lawyer_groups`
--

DROP TABLE IF EXISTS `lawyer_groups`;
CREATE TABLE IF NOT EXISTS `lawyer_groups` (
  `group_id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `group_name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`group_id`),
  UNIQUE KEY `group_name` (`group_name`)
) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `lawyer_groups`
--

INSERT INTO `lawyer_groups` (`group_id`, `group_name`, `created_at`, `updated_at`) VALUES
(1, 'Civil Law', '2026-01-05 13:04:07', '2026-01-05 13:04:07'),
(2, 'Criminal Law', '2026-01-05 13:04:07', '2026-01-05 13:04:07'),
(3, 'Family Law', '2026-01-05 13:04:07', '2026-01-05 13:04:07'),
(4, 'Commercial / Corporate Law', '2026-01-05 13:04:07', '2026-01-05 13:04:07'),
(5, 'Property & Conveyancing Law', '2026-01-05 13:04:07', '2026-01-05 13:04:07'),
(6, 'Labour & Employment Law', '2026-01-05 13:04:07', '2026-01-05 13:04:07'),
(7, 'Constitutional Law', '2026-01-05 13:04:07', '2026-01-05 13:04:07'),
(8, 'Administrative Law', '2026-01-05 13:04:07', '2026-01-05 13:04:07'),
(9, 'Human Rights Law', '2026-01-05 13:04:07', '2026-01-05 13:04:07'),
(10, 'Notarial Practice', '2026-01-05 13:04:07', '2026-01-05 13:04:07'),
(11, 'Intellectual Property Law', '2026-01-05 13:04:07', '2026-01-05 13:04:07'),
(12, 'Mining & Energy Law', '2026-01-05 13:04:07', '2026-01-05 13:04:07'),
(13, 'Environmental Law', '2026-01-05 13:04:07', '2026-01-05 13:04:07'),
(14, 'Tax Law', '2026-01-05 13:04:07', '2026-01-05 13:04:07'),
(15, 'Banking & Finance Law', '2026-01-05 13:04:07', '2026-01-05 13:04:07'),
(16, 'Insolvency Law', '2026-01-05 13:04:07', '2026-01-05 13:04:07'),
(17, 'Insurance Law', '2026-01-05 13:04:07', '2026-01-05 13:04:07'),
(18, 'Estate Planning & Deceased Estates', '2026-01-05 13:04:07', '2026-01-05 13:04:07'),
(19, 'Immigration Law', '2026-01-05 13:04:07', '2026-01-05 13:04:07'),
(20, 'International Law', '2026-01-05 13:04:07', '2026-01-05 13:04:07'),
(21, 'Arbitration & ADR', '2026-01-05 13:04:07', '2026-01-05 13:04:07'),
(22, 'Technology & Cyber Law', '2026-01-05 13:04:07', '2026-01-05 13:04:07');

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

--
-- Table structure for table `lawyer_roles`
--

DROP TABLE IF EXISTS `lawyer_roles`;
CREATE TABLE IF NOT EXISTS `lawyer_roles` (
  `lawyer_role_id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `code` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `side` enum('plaintiff','defendant','prosecution','defense','neutral') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'neutral',
  `is_primary` tinyint(1) NOT NULL DEFAULT '0',
  `requires_bar_status` tinyint(1) NOT NULL DEFAULT '1',
  `jurisdiction_scope` enum('US','UK','GLOBAL') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'GLOBAL',
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `sort_order` int UNSIGNED DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`lawyer_role_id`),
  UNIQUE KEY `code` (`code`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `lawyer_roles`
--

INSERT INTO `lawyer_roles` (`lawyer_role_id`, `code`, `name`, `description`, `side`, `is_primary`, `requires_bar_status`, `jurisdiction_scope`, `is_active`, `sort_order`, `created_at`, `updated_at`) VALUES
(1, 'lead_counsel', 'Lead Counsel', 'Primary attorney representing the party.', 'plaintiff', 1, 1, 'GLOBAL', 1, 1, '2026-01-29 13:05:00', '2026-01-29 11:22:29'),
(2, 'co_counsel', 'Co-Counsel', 'Secondary attorney assisting lead counsel.', 'defense', 0, 1, 'GLOBAL', 1, 2, '2026-01-29 13:05:00', '2026-01-29 13:05:00'),
(3, 'prosecutor', 'Prosecuting Counsel', 'Attorney representing the state in criminal cases.', 'prosecution', 1, 1, 'GLOBAL', 1, 3, '2026-01-29 13:05:00', '2026-01-29 13:05:00'),
(4, 'defense_attorney', 'Defense Attorney', 'Attorney representing the defendant in criminal cases.', 'defense', 1, 1, 'GLOBAL', 1, 4, '2026-01-29 13:05:00', '2026-01-29 13:05:00'),
(5, 'plaintiff_counsel', 'Plaintiff Counsel', 'Attorney representing the plaintiff in civil cases.', 'plaintiff', 1, 1, 'GLOBAL', 1, 5, '2026-01-29 13:05:00', '2026-01-29 13:05:00'),
(6, 'respondent_counsel', 'Respondent Counsel', 'Attorney representing the respondent/defendant in civil cases.', 'defendant', 1, 1, 'GLOBAL', 1, 6, '2026-01-29 13:05:00', '2026-01-29 13:05:00'),
(7, 'amicus_counsel', 'Amicus Curiae', 'Neutral counsel providing expertise without representing a party.', 'neutral', 0, 1, 'GLOBAL', 1, 7, '2026-01-29 13:05:00', '2026-01-29 13:05:00'),
(8, 'mediator', 'Mediator', 'Neutral third-party facilitating settlement or negotiation.', 'neutral', 0, 0, 'GLOBAL', 1, 8, '2026-01-29 13:05:00', '2026-01-29 13:05:00'),
(9, 'legal_advisor', 'Legal Advisor', 'Provides legal guidance without courtroom representation.', 'neutral', 0, 0, 'GLOBAL', 1, 9, '2026-01-29 13:05:00', '2026-01-29 13:05:00'),
(10, 'junior_counsel', 'Junior Counsel', 'Supports lead or co-counsel; limited independent authority.', 'defense', 0, 1, 'GLOBAL', 1, 10, '2026-01-29 13:05:00', '2026-01-29 13:05:00');

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

--
-- Table structure for table `lawyer_types`
--

DROP TABLE IF EXISTS `lawyer_types`;
CREATE TABLE IF NOT EXISTS `lawyer_types` (
  `type_id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `group_id` bigint UNSIGNED NOT NULL,
  `lawyer_type_name` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`type_id`),
  KEY `group_id` (`group_id`)
) ENGINE=InnoDB AUTO_INCREMENT=66 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `lawyer_types`
--

INSERT INTO `lawyer_types` (`type_id`, `group_id`, `lawyer_type_name`, `created_at`, `updated_at`) VALUES
(1, 1, 'Contract Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(2, 1, 'Property Disputes Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(3, 1, 'Debt Collection Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(4, 1, 'Personal Injury Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(5, 1, 'Defamation Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(6, 2, 'Criminal Defence Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(7, 2, 'State Prosecutor', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(8, 2, 'White Collar Crime Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(9, 2, 'Economic Crimes Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(10, 2, 'Bail & Sentencing Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(11, 3, 'Divorce Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(12, 3, 'Child Custody Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(13, 3, 'Maintenance Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(14, 3, 'Adoption Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(15, 3, 'Domestic Violence Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(16, 4, 'Company Formation Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(17, 4, 'Corporate Governance Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(18, 4, 'Mergers & Acquisitions Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(19, 4, 'Commercial Litigation Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(20, 4, 'Shareholder Disputes Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(21, 5, 'Conveyancer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(22, 5, 'Property Transfer Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(23, 5, 'Mortgage Bond Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(24, 5, 'Land Development Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(25, 6, 'Employment Disputes Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(26, 6, 'Retrenchment Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(27, 6, 'Labour Arbitration Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(28, 6, 'Collective Bargaining Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(29, 7, 'Constitutional Litigation Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(30, 7, 'Judicial Review Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(31, 7, 'Electoral Law Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(32, 8, 'Regulatory Compliance Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(33, 8, 'Government Decisions Review Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(34, 9, 'Human Rights Litigation Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(35, 9, 'Police Abuse Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(36, 9, 'Media Freedom Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(37, 10, 'Notary Public', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(38, 10, 'Document Authentication Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(39, 11, 'Trademark Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(40, 11, 'Copyright Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(41, 11, 'Patent Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(42, 12, 'Mining Rights Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(43, 12, 'Energy Contracts Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(44, 13, 'Environmental Compliance Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(45, 13, 'Environmental Litigation Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(46, 14, 'Tax Advisory Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(47, 14, 'ZIMRA Disputes Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(48, 15, 'Banking Compliance Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(49, 15, 'Loan & Securities Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(50, 16, 'Liquidation Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(51, 16, 'Corporate Rescue Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(52, 17, 'Insurance Claims Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(53, 17, 'Policy Disputes Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(54, 18, 'Wills & Trusts Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(55, 18, 'Executor of Estates', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(56, 18, 'Inheritance Disputes Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(57, 19, 'Work Permit Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(58, 19, 'Citizenship Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(59, 20, 'International Arbitration Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(60, 20, 'Cross-Border Trade Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(61, 21, 'Arbitrator', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(62, 21, 'Mediator', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(63, 22, 'Cybercrime Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(64, 22, 'Data Protection Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12'),
(65, 22, 'E-Commerce Lawyer', '2026-01-05 13:46:12', '2026-01-05 13:46:12');

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

--
-- Table structure for table `law_firm_information`
--

DROP TABLE IF EXISTS `law_firm_information`;
CREATE TABLE IF NOT EXISTS `law_firm_information` (
  `company_id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_name` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `company_code` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `firm_initials` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `firm_logo_path` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `address` text COLLATE utf8mb4_unicode_ci,
  `contact_email` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `contact_phone` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `website` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `tax_id` varchar(120) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `bank_name` text COLLATE utf8mb4_unicode_ci,
  `bank_acc_number` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `bank_account_type` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `bank_branch_address` text COLLATE utf8mb4_unicode_ci,
  `updated_by` bigint UNSIGNED DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`company_id`),
  KEY `updated_by` (`updated_by`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `law_firm_information`
--

INSERT INTO `law_firm_information` (`company_id`, `company_name`, `company_code`, `firm_initials`, `firm_logo_path`, `address`, `contact_email`, `contact_phone`, `website`, `tax_id`, `bank_name`, `bank_acc_number`, `bank_account_type`, `bank_branch_address`, `updated_by`, `updated_at`) VALUES
(1, 'Moyo & Partners Legal Practitioners', 'MPL001', 'MPL', NULL, '12 Samora Machel Avenue, 3rd Floor, Harare, Zimbabwe', 'info@moyolegal.co.zw', '+263-242-700123', 'https://www.moyolegal.co.zw', 'ZW12345678', 'CBZ Bank Limited', '0123456789012', 'nostro', 'CBZ Main Branch, Harare', 1, '2026-02-22 12:24:37');

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

--
-- Table structure for table `lexa_chat_history`
--

DROP TABLE IF EXISTS `lexa_chat_history`;
CREATE TABLE IF NOT EXISTS `lexa_chat_history` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `user_id` bigint UNSIGNED NOT NULL,
  `conversation_id` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `role` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'user|assistant|system|tool',
  `message` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `model` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `tokens_input` int DEFAULT NULL,
  `tokens_output` int DEFAULT NULL,
  `metadata` json DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_lex_chat_history_user_id` (`user_id`),
  KEY `idx_lex_chat_history_conversation_id` (`conversation_id`),
  KEY `idx_lex_chat_history_created_at` (`created_at`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `lexa_chat_history`
--

INSERT INTO `lexa_chat_history` (`id`, `user_id`, `conversation_id`, `role`, `message`, `model`, `tokens_input`, `tokens_output`, `metadata`, `created_at`, `updated_at`) VALUES
(1, 1, 'b1f9305b-a670-4b88-bfd9-9162803fd0b2', 'user', 'richard branson', 'meta-llama/Llama-3.2-1B-Instruct', NULL, NULL, NULL, '2026-03-27 17:34:19', '2026-03-27 17:34:19'),
(2, 1, '7e3a1bfa-9ea2-436f-986f-d28222b7df04', 'user', 'microsoft', 'meta-llama/Llama-3.2-1B-Instruct', NULL, NULL, NULL, '2026-03-27 17:34:39', '2026-03-27 17:34:39'),
(3, 1, 'fc433a58-de13-4c83-834f-90582e0208ca', 'user', 'what am i supposed to write when writing a case file as a jnr lawyer', 'meta-llama/Llama-3.2-1B-Instruct', NULL, NULL, NULL, '2026-03-27 17:35:08', '2026-03-27 17:35:08'),
(4, 1, 'fc433a58-de13-4c83-834f-90582e0208ca', 'assistant', 'When writing a case file as a junior lawyer, you should include the following essential elements:\n\n1. **Case Number**: A unique identifier assigned to the case, which includes the party involved, the type of case, and any relevant details.\n2. **Case Description**: A brief summary of the case, including the facts, relevant dates, and key points.\n3. **Parties Involved**: The names and brief descriptions of the parties involved in the case, including the plaintiff, defendant, and any other relevant parties.\n4. **Case Type**: The type of case, such as breach of contract, personal injury, or intellectual property dispute.\n5. **Issue**: A clear statement of the main issue or dispute that needs to be resolved.\n6. **Background**: An overview of the relevant background information, such as relevant laws, regulations, or precedents.\n7. **Arguments**: A summary of the arguments presented in the case, including any relevant evidence, witnesses, and testimony.\n8. **Proposed Solution**: A proposed solution or outcome of the case, which may include a settlement, judgment, or further proceedings.\n9. **Deliverables**: A list of any specific deliverables or tasks required for the case, such as draft pleadings, witness statements, or expert reports.\n10. **Dates**: Relevant dates related to the case, such as court dates, witness statements, or other important events.\n11. **Contact Information**: The contact details for you, the junior lawyer, including your name, email address, and phone number.\n12. **Attachments**: Any relevant attachments, such as court documents, witness statements, or other supporting evidence.\n\nHere\'s an example of what a completed case file might look like:\n\n**Case Number:** HC001234\n**Case Description:** Richard Branson vs. Virgin Group Ltd.\n**Parties Involved:** Richard Branson (plaintiff) and Virgin Group Ltd. (defendant)\n**Case Type:** Breach of Contract\n**Issue:** Whether Richard Branson has breached his contract with Virgin Group Ltd.\n**Background:** Richard Branson has a contract with Virgin Group Ltd. to promote their products and services, but has failed to meet his obligations under the contract.\n**Arguments:** The plaintiff argues that the defendant has breached the contract and is therefore liable for damages.\n**Proposed Solution:** The proposed solution is that the defendant pays Richard Branson a sum of £1 million in damages.\n**Deliverables:** Draft', 'meta-llama/Llama-3.2-1B-Instruct', 88, 500, '{\"endpoint\": \"https://router.huggingface.co/v1/chat/completions\"}', '2026-03-27 17:35:12', '2026-03-27 17:35:12'),
(5, 1, '9a838e60-a262-46e1-aeef-048f96f40a69', 'user', 'hello', 'meta-llama/Llama-3.2-1B-Instruct', NULL, NULL, NULL, '2026-03-30 05:37:15', '2026-03-30 05:37:15'),
(6, 1, '9a838e60-a262-46e1-aeef-048f96f40a69', 'assistant', 'Hello again. How can I assist you today?', 'meta-llama/Llama-3.2-1B-Instruct', 42, 11, '{\"endpoint\": \"https://router.huggingface.co/v1/chat/completions\"}', '2026-03-30 05:37:18', '2026-03-30 05:37:18'),
(7, 1, '9a838e60-a262-46e1-aeef-048f96f40a69', 'user', 'who is donald trump', 'meta-llama/Llama-3.2-1B-Instruct', NULL, NULL, NULL, '2026-03-30 05:37:24', '2026-03-30 05:37:24'),
(8, 1, '9a838e60-a262-46e1-aeef-048f96f40a69', 'assistant', 'Donald Trump is the 45th President of the United States, serving from 2017 to 2021. He is a businessman, television personality, and politician who gained notoriety in the 2016 presidential election as the Republican Party\'s nominee.\n\nEarly Life and Career:\n\nDonald Trump was born on June 14, 1946, in Queens, New York, to Mary Anne MacLeod and Frederick Christ Trump. He has five siblings, including his twin brother Donald Jr., who is also a businessman. Trump\'s father was a successful real estate developer who built a significant portfolio of properties in Queens and the surrounding areas.\n\nTrump attended the New York Military Academy and later studied at the University of Pennsylvania, where he graduated with a degree in economics in 1968. He then attended Harvard Business School, but did not graduate.\n\nBusiness Career:\n\nTrump\'s business career began in the 1970s, when he opened his first restaurant, the Trump Taxi and Trucking Company, in 1971. He later expanded his business empire, investing in real estate, including the Trump Tower in New York City, which he bought in 1983.\n\nIn the 1980s, Trump expanded his real estate business, buying the Grand Hyatt Hotel in New York City and opening the Trump Plaza Hotel and Casino in Atlantic City. He also invested in golf courses, resorts, and casinos around the world.\n\nPresidential Campaign and Presidency:\n\nTrump announced his candidacy for the Republican presidential nomination in June 2015, running on a platform of tax cuts, deregulation, and a tough stance on immigration. He won the nomination at the Republican National Convention in July 2016, becoming the first Republican to win the nomination since 1988.\n\nOn November 8, 2016, Trump won the presidential election, defeating Democratic nominee Hillary Clinton in a highly contested election. As president, Trump pursued a \"America First\" agenda, focusing on trade policies, immigration reform, and national security.\n\nDuring his presidency, Trump implemented various policies, including:\n\n* Border wall construction along the US-Mexico border\n* Tax cuts and deregulation\n* Immigration reform, including the \"Dream Act\" and the introduction of a travel ban on predominantly Muslim countries\n* Withdrawal from the Paris Climate Agreement\n* Repeal of the Affordable Care Act (Obamacare)\n\nControversies and Scandals:\n\nTrump\'s presidency was marked by numerous controversies and scandals, including:\n\n* Stormy Daniels and', 'meta-llama/Llama-3.2-1B-Instruct', 71, 500, '{\"endpoint\": \"https://router.huggingface.co/v1/chat/completions\"}', '2026-03-30 05:37:27', '2026-03-30 05:37:27'),
(9, 1, 'a2f47b32-c454-4710-a66e-cd349fe4856f', 'user', 'who is mugabe', 'meta-llama/Llama-3.2-1B-Instruct', NULL, NULL, NULL, '2026-03-30 06:47:53', '2026-03-30 06:47:53'),
(10, 1, 'a2f47b32-c454-4710-a66e-cd349fe4856f', 'assistant', 'Zimbabwe\'s Robert Mugabe (1924-2019) was a Zimbabwean politician who served as the country\'s first black president from 1980 to 2017. He was a key figure in the fight against apartheid in South Africa and a major force in Pan-Africanism.\n\nEarly Life and Education:\n\nRobert Mugabe was born in the village of Nkhata Bay, in what was then Northern Rhodesia (now Zambia). He was the son of a local chief and grew up in a traditional Zonde people community. Mugabe attended a Catholic boarding school in Rhodesia and later studied law at the University of Fort Hare in South Africa.\n\nMugabe joined the African National Congress (ANC) in 1947 and quickly rose through the ranks. He became a key leader in the ANC\'s fight against apartheid in South Africa, where he was arrested and imprisoned for his activism. In 1964, Mugabe was released from prison and went into exile, where he continued to fight for African independence and self-determination.\n\nReturn to Zimbabwe:\n\nIn 1968, Mugabe returned to Zimbabwe with a small group of ANC fighters. He became the vice president of the newly independent country, but soon rose to the position of first secretary general and then prime minister.\n\nMugabe\'s leadership style was characterized by authoritarianism, nationalism, and anti-imperialism. He implemented a range of policies aimed at promoting economic development, social welfare, and national unity.\n\nRepression and Coup:\n\nHowever, Mugabe\'s rule was marked by repression, censorship, and human rights abuses. He suppressed opposition movements, arrested and imprisoned critics, and imposed strict controls on the media and civil society.\n\nIn 1980, a military coup led by Mugabe\'s Zimbabwe African National Union (ZANU) overthrew the government of Prime Minister Ian Smith. Mugabe became president and ruled with an iron fist, consolidating his power and suppressing opposition.\n\nMugabe\'s rule was marked by corruption, cronyism, and widespread human rights abuses. The economy struggled, and the country was plagued by poverty, food shortages, and violence.\n\nInternational Criticism:\n\nMugabe\'s rule was widely criticized by the international community, including the United States, the European Union, and the Association of Caribbean States. The United Nations condemned his human rights abuses and forced him to leave office in 2003.\n\nAfter the 2008 presidential election, which saw Robert Mugabe\'s ZAN', 'meta-llama/Llama-3.2-1B-Instruct', 48, 500, '{\"endpoint\": \"https://router.huggingface.co/v1/chat/completions\"}', '2026-03-30 06:48:00', '2026-03-30 06:48:00');

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

--
-- Table structure for table `lexa_conversations`
--

DROP TABLE IF EXISTS `lexa_conversations`;
CREATE TABLE IF NOT EXISTS `lexa_conversations` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `user_id` bigint UNSIGNED NOT NULL,
  `conversation_key` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
  `title` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `status` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT 'active',
  `last_message_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uq_lex_conversation_key` (`conversation_key`),
  KEY `idx_lex_conversations_user_id` (`user_id`),
  KEY `idx_lex_conversations_last_message_at` (`last_message_at`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `lexa_conversations`
--

INSERT INTO `lexa_conversations` (`id`, `user_id`, `conversation_key`, `title`, `status`, `last_message_at`, `created_at`, `updated_at`) VALUES
(1, 1, 'b1f9305b-a670-4b88-bfd9-9162803fd0b2', 'richard branson', 'active', '2026-03-27 17:34:19', '2026-03-27 17:34:19', '2026-03-27 17:34:19'),
(2, 1, '7e3a1bfa-9ea2-436f-986f-d28222b7df04', 'microsoft', 'active', '2026-03-27 17:34:39', '2026-03-27 17:34:39', '2026-03-27 17:34:39'),
(3, 1, 'fc433a58-de13-4c83-834f-90582e0208ca', 'what am i supposed to write when writing a case file as a jnr lawyer', 'active', '2026-03-27 17:35:12', '2026-03-27 17:35:08', '2026-03-27 17:35:12'),
(4, 1, '9a838e60-a262-46e1-aeef-048f96f40a69', 'hello', 'active', '2026-03-30 05:37:27', '2026-03-30 05:37:15', '2026-03-30 05:37:27'),
(5, 1, 'a2f47b32-c454-4710-a66e-cd349fe4856f', 'who is mugabe', 'active', '2026-03-30 06:48:00', '2026-03-30 06:47:53', '2026-03-30 06:48:00');

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

--
-- Table structure for table `matters`
--

DROP TABLE IF EXISTS `matters`;
CREATE TABLE IF NOT EXISTS `matters` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `matter_number` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `matter_title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `category_id` bigint UNSIGNED DEFAULT NULL,
  `type_id` bigint UNSIGNED DEFAULT NULL,
  `status_id` bigint UNSIGNED DEFAULT NULL,
  `priority_id` bigint UNSIGNED DEFAULT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `opened_date` date DEFAULT NULL,
  `closed_date` date DEFAULT NULL,
  `created_by` bigint UNSIGNED DEFAULT NULL,
  `updated_by` bigint UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `matters_matter_number_unique` (`matter_number`),
  KEY `matters_created_by_foreign` (`created_by`),
  KEY `matters_updated_by_foreign` (`updated_by`),
  KEY `matters_type_id_index` (`type_id`),
  KEY `matters_category_id_foreign` (`category_id`),
  KEY `matters_status_id_foreign` (`status_id`),
  KEY `matters_priority_id_foreign` (`priority_id`)
) ENGINE=InnoDB AUTO_INCREMENT=53 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `matters`
--

INSERT INTO `matters` (`id`, `matter_number`, `matter_title`, `category_id`, `type_id`, `status_id`, `priority_id`, `description`, `opened_date`, `closed_date`, `created_by`, `updated_by`, `created_at`, `updated_at`) VALUES
(1, 'MAT-2026-0001', 'Breach of Contract – Vendor', 4, 2, NULL, 3, 'Dispute over delayed vendor deliverables.', '2026-03-13', NULL, 1, 1, '2026-03-13 11:22:12', '2026-03-13 11:22:12'),
(2, 'MAT-2026-0002', 'Assault Investigation', 7, 4, NULL, 5, 'Investigation pending witness statements.', '2026-03-13', NULL, 1, 1, '2026-03-13 11:22:12', '2026-03-13 11:22:12'),
(3, 'MAT-2026-0003', 'Patent Infringement Claim', 15, 5, NULL, 6, 'Alleged infringement of registered process patent.', '2026-03-13', NULL, 1, 1, '2026-03-13 11:22:12', '2026-03-13 11:22:12'),
(4, 'MAT-2026-0004', 'Employment Termination Dispute', 4, 2, NULL, 4, 'Client contesting wrongful dismissal.', '2026-03-13', NULL, 1, 1, '2026-03-13 11:22:12', '2026-03-13 11:22:12'),
(5, 'MAT-2026-0005', 'Trademark Opposition', 15, 3, NULL, 2, 'Opposition filed against trademark registration.', '2026-03-13', NULL, 1, 1, '2026-03-13 11:22:12', '2026-03-13 11:22:12'),
(6, 'MAT-2026-0006', 'Landlord-Tenant Dispute', 4, 2, NULL, 3, 'Tenant refusing to vacate property.', '2026-03-13', NULL, 1, 1, '2026-03-13 11:22:12', '2026-03-13 11:22:12'),
(7, 'MAT-2026-0007', 'Product Liability Claim', 4, 5, NULL, 4, 'Injury caused by defective product.', '2026-03-13', NULL, 1, 1, '2026-03-13 11:22:12', '2026-03-13 11:22:12'),
(8, 'MAT-2026-0008', 'Fraud Investigation', 7, 4, NULL, 5, 'Financial irregularities under review.', '2026-03-13', NULL, 1, 1, '2026-03-13 11:22:12', '2026-03-13 11:22:12'),
(9, 'MAT-2026-0009', 'Copyright Infringement', 15, 5, NULL, 6, 'Unauthorized use of copyrighted material.', '2026-03-13', NULL, 1, 1, '2026-03-13 11:22:12', '2026-03-13 11:22:12'),
(10, 'MAT-2026-0010', 'Medical Malpractice', 4, 3, NULL, 4, 'Negligence claim against hospital staff.', '2026-03-13', NULL, 1, 1, '2026-03-13 11:22:12', '2026-03-13 11:22:12'),
(11, 'MAT-2026-0011', 'Insurance Dispute', 4, 2, NULL, 3, 'Claim denied by insurance provider.', '2026-03-13', NULL, 1, 1, '2026-03-13 11:22:12', '2026-03-13 11:22:12'),
(12, 'MAT-2026-0012', 'Environmental Regulation Violation', 4, 4, NULL, 5, 'Pollution incident under investigation.', '2026-03-13', NULL, 1, 1, '2026-03-13 11:22:12', '2026-03-13 11:22:12'),
(13, 'MAT-2026-0013', 'Cybercrime Investigation', 7, 5, NULL, 6, 'Hacking incident affecting multiple clients.', '2026-03-13', NULL, 1, 1, '2026-03-13 11:22:12', '2026-03-13 11:22:12'),
(14, 'MAT-2026-0014', 'Construction Dispute', 4, 2, NULL, 4, 'Contractor failing to meet specifications.', '2026-03-13', NULL, 1, 1, '2026-03-13 11:22:12', '2026-03-13 11:22:12'),
(15, 'MAT-2026-0015', 'Vehicle Accident Claim', 4, 3, NULL, 3, 'Road accident, multiple parties involved.', '2026-03-13', NULL, 1, 1, '2026-03-13 11:22:12', '2026-03-13 11:22:12'),
(16, 'MAT-2026-0016', 'Tax Evasion Investigation', 7, 4, NULL, 5, 'Audit for undeclared income.', '2026-03-13', NULL, 1, 1, '2026-03-13 11:22:12', '2026-03-13 11:22:12'),
(17, 'MAT-2026-0017', 'Intellectual Property Licensing Dispute', 15, 5, NULL, 6, 'Breach of licensing agreement.', '2026-03-13', NULL, 1, 1, '2026-03-13 11:22:12', '2026-03-13 11:22:12'),
(18, 'MAT-2026-0018', 'Debt Recovery', 4, 2, NULL, 3, 'Client seeking recovery of unpaid invoices.', '2026-03-13', NULL, 1, 1, '2026-03-13 11:22:12', '2026-03-13 11:22:12'),
(19, 'MAT-2026-0019', 'Bankruptcy Proceedings', 4, 3, NULL, 4, 'Liquidation process initiated.', '2026-03-13', NULL, 1, 1, '2026-03-13 11:22:12', '2026-03-13 11:22:12'),
(20, 'MAT-2026-0020', 'Criminal Theft Case', 7, 4, NULL, 5, 'Investigation ongoing.', '2026-03-13', NULL, 1, 1, '2026-03-13 11:22:12', '2026-03-13 11:22:12'),
(21, 'MAT-2026-0021', 'Consumer Rights Violation', 4, 2, NULL, 3, 'Complaint against retailer.', '2026-03-13', NULL, 1, 1, '2026-03-13 11:22:12', '2026-03-13 11:22:12'),
(22, 'MAT-2026-0022', 'Antitrust Investigation', 4, 3, NULL, 4, 'Market manipulation under review.', '2026-03-13', NULL, 1, 1, '2026-03-13 11:22:12', '2026-03-13 11:22:12'),
(23, 'MAT-2026-0023', 'Harassment Complaint', 7, 4, NULL, 5, 'Investigation into workplace harassment.', '2026-03-13', NULL, 1, 1, '2026-03-13 11:22:12', '2026-03-13 11:22:12'),
(24, 'MAT-2026-0024', 'Fraudulent Contract', 4, 2, NULL, 3, 'Alleged fraudulent business contract.', '2026-03-13', NULL, 1, 1, '2026-03-13 11:22:12', '2026-03-13 11:22:12'),
(25, 'MAT-2026-0025', 'Sample Case 25', 4, 3, NULL, 4, 'Placeholder case for testing.', '2026-03-13', NULL, 1, 1, '2026-03-13 11:22:12', '2026-03-13 11:22:12'),
(26, 'MAT-2026-0026', 'Seeded Matter 1', 54, 58, 39, 18, 'Seeded matter description', '2026-01-21', NULL, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(27, 'MAT-2026-0027', 'Seeded Matter 2', 54, 12, 43, 27, 'Seeded matter description', '2026-02-10', NULL, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(28, 'MAT-2026-0028', 'Seeded Matter 3', 56, 19, 35, 28, 'Seeded matter description', '2026-02-20', NULL, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(29, 'MAT-2026-0029', 'Seeded Matter 4', 44, 19, 47, 2, 'Seeded matter description', '2026-02-22', NULL, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(30, 'MAT-2026-0030', 'Seeded Matter 5', 53, 43, 39, 15, 'Seeded matter description', '2026-01-22', NULL, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(31, 'MAT-2026-0031', 'Seeded Matter 6', 58, 20, 42, 20, 'Seeded matter description', '2026-01-19', NULL, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(32, 'MAT-2026-0032', 'Seeded Matter 7', 49, 14, 48, 17, 'Seeded matter description', '2026-01-18', NULL, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(33, 'MAT-2026-0033', 'Seeded Matter 8', 63, 12, 1, 11, 'Seeded matter description', '2026-02-08', NULL, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(34, 'MAT-2026-0034', 'Seeded Matter 9', 15, 18, 49, 23, 'Seeded matter description', '2026-02-17', NULL, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(35, 'MAT-2026-0035', 'Seeded Matter 10', 7, 19, 42, 9, 'Seeded matter description', '2026-02-27', NULL, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(36, 'MAT-2026-0036', 'Seeded Matter 11', 5, 43, 3, 20, 'Seeded matter description', '2026-03-09', NULL, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(37, 'MAT-2026-0037', 'Seeded Matter 12', 35, 44, 39, 6, 'Seeded matter description', '2026-02-13', NULL, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(38, 'MAT-2026-0038', 'Seeded Matter 13', 53, 8, 32, 12, 'Seeded matter description', '2026-03-09', NULL, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(39, 'MAT-2026-0039', 'Seeded Matter 14', 12, 18, 35, 23, 'Seeded matter description', '2026-02-05', NULL, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(40, 'MAT-2026-0040', 'Seeded Matter 15', 46, 39, 45, 10, 'Seeded matter description', '2026-01-20', NULL, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(41, 'MAT-2026-0041', 'Seeded Matter 16', 18, 42, 40, 2, 'Seeded matter description', '2026-02-18', NULL, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(42, 'MAT-2026-0042', 'Seeded Matter 17', 57, 8, 35, 12, 'Seeded matter description', '2026-02-24', NULL, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(43, 'MAT-2026-0043', 'Seeded Matter 18', 46, 25, 39, 2, 'Seeded matter description', '2026-01-22', NULL, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(44, 'MAT-2026-0044', 'Seeded Matter 19', 53, 21, 1, 26, 'Seeded matter description', '2026-03-03', NULL, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(45, 'MAT-2026-0045', 'Seeded Matter 20', 25, 41, 44, 2, 'Seeded matter description', '2026-02-23', NULL, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(46, 'MAT-2026-0046', 'Seeded Matter 21', 42, 51, 48, 20, 'Seeded matter description', '2026-02-19', NULL, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(47, 'MAT-2026-0047', 'Seeded Matter 22', 64, 9, 44, 16, 'Seeded matter description', '2026-01-29', NULL, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(48, 'MAT-2026-0048', 'Seeded Matter 23', 59, 13, 52, 4, 'Seeded matter description', '2026-02-02', NULL, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(49, 'MAT-2026-0049', 'Seeded Matter 24', 44, 21, 2, 4, 'Seeded matter description', '2026-02-13', NULL, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(50, 'MAT-2026-0050', 'Seeded Matter 25', 8, 31, 45, 21, 'Seeded matter description', '2026-03-10', NULL, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(51, 'MAT-2026-0051', 'Will drafting', NULL, NULL, NULL, NULL, 'gwena inheritance', '2026-03-23', NULL, 1, 1, '2026-03-23 10:49:07', '2026-03-23 10:49:07'),
(52, 'MAT-2026-0052', 'Gwena estate allocations', 20, 13, 3, 4, 'allcocations', '2026-03-23', NULL, 1, 1, '2026-03-23 11:07:06', '2026-03-23 11:07:06');

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

--
-- Table structure for table `matter_categories`
--

DROP TABLE IF EXISTS `matter_categories`;
CREATE TABLE IF NOT EXISTS `matter_categories` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `name` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `created_by` bigint UNSIGNED DEFAULT NULL,
  `updated_by` bigint UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `matter_categories_name_unique` (`name`),
  KEY `matter_categories_created_by_foreign` (`created_by`),
  KEY `matter_categories_updated_by_foreign` (`updated_by`)
) ENGINE=InnoDB AUTO_INCREMENT=65 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `matter_categories`
--

INSERT INTO `matter_categories` (`id`, `name`, `description`, `created_by`, `updated_by`, `created_at`, `updated_at`) VALUES
(1, 'ADM', 'Administrative Law', NULL, NULL, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(2, 'BNK', 'Bankruptcy & Insolvency', NULL, NULL, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(3, 'BOLO', 'DSDSSS', NULL, NULL, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(4, 'CIV', 'Civil Litigation', NULL, NULL, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(5, 'CON', 'Construction Law', NULL, NULL, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(6, 'COR', 'Corporate & Commercial', NULL, NULL, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(7, 'CRM', 'Criminal Defense', NULL, NULL, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(8, 'EMP', 'Employment & Labor Law', NULL, NULL, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(9, 'ENV', 'Environmental Law', NULL, NULL, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(10, 'EST', 'Estate Planning & Probate', NULL, NULL, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(11, 'FAM', 'Family Law', NULL, NULL, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(12, 'IMM', 'Immigration Law', NULL, NULL, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(13, 'INS', 'Insurance Law', NULL, NULL, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(14, 'INT', 'International Law', NULL, NULL, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(15, 'IP', 'Intellectual Property', NULL, NULL, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(16, 'MED', 'Medical Malpractice', NULL, NULL, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(17, 'TAX', 'Taxation Law', NULL, NULL, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(18, 'Commercial', 'Category description for Commercial', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(19, 'Employment', 'Category description for Employment', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(20, 'Estates', 'Category description for Estates', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(21, 'Category 4', 'Category description for Category 4', 8, 8, '2026-03-19 11:04:56', '2026-03-19 11:04:56'),
(22, 'Category 5', 'Category description for Category 5', 8, 8, '2026-03-19 11:04:56', '2026-03-19 11:04:56'),
(23, 'Category 6', 'Category description for Category 6', 8, 8, '2026-03-19 11:04:56', '2026-03-19 11:04:56'),
(24, 'Category 7', 'Category description for Category 7', 8, 8, '2026-03-19 11:04:56', '2026-03-19 11:04:56'),
(25, 'Category 8', 'Category description for Category 8', 8, 8, '2026-03-19 11:04:56', '2026-03-19 11:04:56'),
(26, 'Category 9', 'Category description for Category 9', 8, 8, '2026-03-19 11:04:56', '2026-03-19 11:04:56'),
(27, 'Category 10', 'Category description for Category 10', 8, 8, '2026-03-19 11:04:56', '2026-03-19 11:04:56'),
(28, 'Category 11', 'Category description for Category 11', 8, 8, '2026-03-19 11:04:56', '2026-03-19 11:04:56'),
(29, 'Category 12', 'Category description for Category 12', 8, 8, '2026-03-19 11:04:56', '2026-03-19 11:04:56'),
(30, 'Category 13', 'Category description for Category 13', 8, 8, '2026-03-19 11:04:56', '2026-03-19 11:04:56'),
(31, 'Category 14', 'Category description for Category 14', 8, 8, '2026-03-19 11:04:56', '2026-03-19 11:04:56'),
(32, 'Category 15', 'Category description for Category 15', 8, 8, '2026-03-19 11:04:56', '2026-03-19 11:04:56'),
(33, 'Category 16', 'Category description for Category 16', 8, 8, '2026-03-19 11:04:56', '2026-03-19 11:04:56'),
(34, 'Category 17', 'Category description for Category 17', 8, 8, '2026-03-19 11:04:56', '2026-03-19 11:04:56'),
(35, 'Category 18', 'Category description for Category 18', 8, 8, '2026-03-19 11:04:56', '2026-03-19 11:04:56'),
(36, 'Category 19', 'Category description for Category 19', 8, 8, '2026-03-19 11:04:56', '2026-03-19 11:04:56'),
(37, 'Category 20', 'Category description for Category 20', 8, 8, '2026-03-19 11:04:56', '2026-03-19 11:04:56'),
(38, 'Category 21', 'Category description for Category 21', 8, 8, '2026-03-19 11:04:56', '2026-03-19 11:04:56'),
(39, 'Category 22', 'Category description for Category 22', 8, 8, '2026-03-19 11:04:56', '2026-03-19 11:04:56'),
(40, 'Category 23', 'Category description for Category 23', 8, 8, '2026-03-19 11:04:56', '2026-03-19 11:04:56'),
(41, 'Category 24', 'Category description for Category 24', 8, 8, '2026-03-19 11:04:56', '2026-03-19 11:04:56'),
(42, 'Category 25', 'Category description for Category 25', 8, 8, '2026-03-19 11:04:56', '2026-03-19 11:04:56'),
(43, 'Category 1', 'Category description for Category 1', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(44, 'Category 2', 'Category description for Category 2', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(45, 'Category 3', 'Category description for Category 3', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(46, 'Category 26', 'Category description for Category 26', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(47, 'Category 27', 'Category description for Category 27', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(48, 'Category 28', 'Category description for Category 28', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(49, 'Category 29', 'Category description for Category 29', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(50, 'Category 30', 'Category description for Category 30', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(51, 'Category 31', 'Category description for Category 31', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(52, 'Category 32', 'Category description for Category 32', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(53, 'Category 33', 'Category description for Category 33', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(54, 'Category 34', 'Category description for Category 34', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(55, 'Category 35', 'Category description for Category 35', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(56, 'Category 36', 'Category description for Category 36', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(57, 'Category 37', 'Category description for Category 37', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(58, 'Category 38', 'Category description for Category 38', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(59, 'Category 39', 'Category description for Category 39', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(60, 'Category 40', 'Category description for Category 40', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(61, 'Category 41', 'Category description for Category 41', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(62, 'Category 42', 'Category description for Category 42', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(63, 'Category 43', 'Category description for Category 43', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(64, 'Category 44', 'Category description for Category 44', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20');

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

--
-- Table structure for table `matter_clients`
--

DROP TABLE IF EXISTS `matter_clients`;
CREATE TABLE IF NOT EXISTS `matter_clients` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `matter_id` bigint UNSIGNED NOT NULL,
  `client_id` bigint UNSIGNED NOT NULL,
  `role_id` bigint UNSIGNED DEFAULT NULL,
  `is_primary_client` tinyint(1) NOT NULL DEFAULT '0',
  `created_by` bigint UNSIGNED DEFAULT NULL,
  `updated_by` bigint UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `matter_clients_created_by_foreign` (`created_by`),
  KEY `matter_clients_updated_by_foreign` (`updated_by`),
  KEY `matter_clients_matter_id_index` (`matter_id`),
  KEY `matter_clients_client_id_index` (`client_id`),
  KEY `matter_clients_role_id_foreign` (`role_id`)
) ENGINE=InnoDB AUTO_INCREMENT=56 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `matter_clients`
--

INSERT INTO `matter_clients` (`id`, `matter_id`, `client_id`, `role_id`, `is_primary_client`, `created_by`, `updated_by`, `created_at`, `updated_at`) VALUES
(1, 1, 1, 1, 0, 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(2, 2, 2, 1, 0, 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(3, 2, 3, 7, 0, 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(4, 3, 4, 2, 0, 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(5, 3, 5, 8, 0, 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(6, 4, 6, 1, 0, 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(7, 4, 7, 7, 0, 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(8, 4, 8, 4, 0, 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(9, 5, 9, 2, 0, 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(10, 6, 10, 1, 0, 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(11, 6, 11, 4, 0, 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(12, 7, 12, 2, 0, 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(13, 7, 13, 8, 0, 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(14, 7, 14, 3, 0, 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(15, 8, 15, 1, 0, 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(16, 8, 16, 7, 0, 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(17, 8, 17, 3, 0, 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(18, 8, 18, 4, 0, 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(19, 9, 19, 1, 0, 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(20, 10, 20, 2, 0, 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(21, 10, 21, 4, 0, 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(22, 11, 22, 1, 0, 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(23, 11, 23, 3, 0, 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(24, 11, 24, 4, 0, 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(25, 12, 25, 2, 0, 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(26, 12, 26, 8, 0, 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(27, 12, 27, 3, 0, 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(28, 12, 28, 4, 0, 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(29, 13, 29, 1, 0, 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(30, 13, 30, 4, 0, 1, 1, '2026-03-13 12:12:18', '2026-03-13 12:12:18'),
(31, 44, 5, 20, 1, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(32, 16, 15, 31, 0, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(33, 41, 8, 24, 0, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(34, 48, 1, 8, 1, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(35, 29, 3, 20, 1, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(36, 48, 14, 10, 0, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(37, 18, 15, 32, 1, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(38, 30, 1, 13, 0, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(39, 21, 3, 18, 0, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(40, 40, 12, 17, 1, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(41, 47, 3, 26, 1, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(42, 35, 12, 15, 1, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(43, 4, 15, 32, 1, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(44, 30, 16, 5, 1, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(45, 4, 9, 3, 0, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(46, 3, 1, 19, 1, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(47, 1, 11, 31, 1, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(48, 12, 15, 5, 0, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(49, 39, 8, 18, 1, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(50, 27, 5, 16, 0, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(51, 38, 5, 13, 1, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(52, 37, 11, 20, 0, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(53, 50, 17, 5, 1, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(54, 43, 13, 18, 0, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(55, 18, 15, 4, 0, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20');

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

--
-- Table structure for table `matter_lawyers`
--

DROP TABLE IF EXISTS `matter_lawyers`;
CREATE TABLE IF NOT EXISTS `matter_lawyers` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `matter_id` bigint UNSIGNED NOT NULL,
  `lawyer_id` bigint UNSIGNED DEFAULT NULL,
  `role_id` bigint UNSIGNED DEFAULT NULL,
  `is_lead_lawyer` tinyint(1) NOT NULL DEFAULT '0',
  `created_by` bigint UNSIGNED DEFAULT NULL,
  `updated_by` bigint UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `matter_lawyers_created_by_foreign` (`created_by`),
  KEY `matter_lawyers_updated_by_foreign` (`updated_by`),
  KEY `matter_lawyers_matter_id_index` (`matter_id`),
  KEY `matter_lawyers_lawyer_id_index` (`lawyer_id`),
  KEY `matter_lawyers_role_id_foreign` (`role_id`)
) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `matter_lawyers`
--

INSERT INTO `matter_lawyers` (`id`, `matter_id`, `lawyer_id`, `role_id`, `is_lead_lawyer`, `created_by`, `updated_by`, `created_at`, `updated_at`) VALUES
(1, 45, 4, 32, 1, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(2, 26, 2, 33, 1, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(3, 32, 1, 10, 1, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(4, 47, 6, 8, 1, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(5, 13, 7, 24, 1, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(6, 33, 1, 6, 0, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(7, 38, 4, 20, 0, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(8, 21, 1, 17, 1, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(9, 38, 9, 20, 0, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(10, 41, 7, 1, 1, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(11, 11, 7, 31, 1, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(12, 20, 6, 9, 0, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(13, 40, 10, 24, 0, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(14, 16, 7, 29, 1, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(15, 10, 3, 9, 1, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(16, 46, 5, 20, 1, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(17, 49, 10, 13, 0, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(18, 24, 3, 28, 0, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(19, 46, 4, 12, 1, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(20, 28, 7, 31, 0, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(21, 45, 9, 22, 0, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(22, 31, 6, 26, 0, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(23, 27, 2, 18, 0, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(24, 14, 3, 21, 1, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(25, 38, 1, 7, 1, 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20');

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

--
-- Table structure for table `matter_outcomes`
--

DROP TABLE IF EXISTS `matter_outcomes`;
CREATE TABLE IF NOT EXISTS `matter_outcomes` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `name` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `created_by` bigint UNSIGNED DEFAULT NULL,
  `updated_by` bigint UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `matter_outcomes_name_unique` (`name`),
  KEY `matter_outcomes_created_by_foreign` (`created_by`),
  KEY `matter_outcomes_updated_by_foreign` (`updated_by`)
) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `matter_outcomes`
--

INSERT INTO `matter_outcomes` (`id`, `name`, `description`, `created_by`, `updated_by`, `created_at`, `updated_at`) VALUES
(1, 'Won', 'Case resolved in favor of the client', NULL, NULL, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(2, 'Lost', 'Case resolved against the client', NULL, NULL, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(3, 'Settled', 'Case resolved via settlement agreement', NULL, NULL, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(4, 'Dismissed', 'Case dismissed by the court', NULL, NULL, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(5, 'Withdrawn', 'Case withdrawn by the client or attorney', NULL, NULL, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(6, 'Pending', 'Case still ongoing, no final outcome yet', NULL, NULL, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(7, 'Appealed', 'Case outcome is under appeal', NULL, NULL, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(8, 'Outcome 1', 'Outcome description for Outcome 1', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(9, 'Outcome 2', 'Outcome description for Outcome 2', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(10, 'Outcome 3', 'Outcome description for Outcome 3', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(11, 'Outcome 4', 'Outcome description for Outcome 4', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(12, 'Outcome 5', 'Outcome description for Outcome 5', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(13, 'Outcome 6', 'Outcome description for Outcome 6', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(14, 'Outcome 7', 'Outcome description for Outcome 7', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(15, 'Outcome 8', 'Outcome description for Outcome 8', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(16, 'Outcome 9', 'Outcome description for Outcome 9', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(17, 'Outcome 10', 'Outcome description for Outcome 10', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(18, 'Outcome 11', 'Outcome description for Outcome 11', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(19, 'Outcome 12', 'Outcome description for Outcome 12', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(20, 'Outcome 13', 'Outcome description for Outcome 13', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(21, 'Outcome 14', 'Outcome description for Outcome 14', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(22, 'Outcome 15', 'Outcome description for Outcome 15', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(23, 'Outcome 16', 'Outcome description for Outcome 16', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(24, 'Outcome 17', 'Outcome description for Outcome 17', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(25, 'Outcome 18', 'Outcome description for Outcome 18', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(26, 'Outcome 19', 'Outcome description for Outcome 19', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(27, 'Outcome 20', 'Outcome description for Outcome 20', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(28, 'Outcome 21', 'Outcome description for Outcome 21', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(29, 'Outcome 22', 'Outcome description for Outcome 22', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(30, 'Outcome 23', 'Outcome description for Outcome 23', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(31, 'Outcome 24', 'Outcome description for Outcome 24', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(32, 'Outcome 25', 'Outcome description for Outcome 25', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20');

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

--
-- Table structure for table `matter_priorities`
--

DROP TABLE IF EXISTS `matter_priorities`;
CREATE TABLE IF NOT EXISTS `matter_priorities` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `name` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `created_by` bigint UNSIGNED DEFAULT NULL,
  `updated_by` bigint UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `matter_priorities_name_unique` (`name`),
  KEY `matter_priorities_created_by_foreign` (`created_by`),
  KEY `matter_priorities_updated_by_foreign` (`updated_by`)
) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `matter_priorities`
--

INSERT INTO `matter_priorities` (`id`, `name`, `description`, `created_by`, `updated_by`, `created_at`, `updated_at`) VALUES
(1, 'Low', 'Priority description for Low', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(2, 'Normal', 'Standard case priority', NULL, NULL, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(3, 'Medium', 'Priority description for Medium', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(4, 'High', 'Priority description for High', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(5, 'Urgent', 'Immediate action required', NULL, NULL, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(6, 'Critical', 'Court-mandated or high-risk matter', NULL, NULL, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(7, 'Priority 1', 'Priority description for Priority 1', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(8, 'Priority 2', 'Priority description for Priority 2', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(9, 'Priority 3', 'Priority description for Priority 3', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(10, 'Priority 4', 'Priority description for Priority 4', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(11, 'Priority 5', 'Priority description for Priority 5', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(12, 'Priority 6', 'Priority description for Priority 6', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(13, 'Priority 7', 'Priority description for Priority 7', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(14, 'Priority 8', 'Priority description for Priority 8', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(15, 'Priority 9', 'Priority description for Priority 9', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(16, 'Priority 10', 'Priority description for Priority 10', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(17, 'Priority 11', 'Priority description for Priority 11', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(18, 'Priority 12', 'Priority description for Priority 12', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(19, 'Priority 13', 'Priority description for Priority 13', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(20, 'Priority 14', 'Priority description for Priority 14', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(21, 'Priority 15', 'Priority description for Priority 15', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(22, 'Priority 16', 'Priority description for Priority 16', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(23, 'Priority 17', 'Priority description for Priority 17', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(24, 'Priority 18', 'Priority description for Priority 18', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(25, 'Priority 19', 'Priority description for Priority 19', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(26, 'Priority 20', 'Priority description for Priority 20', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(27, 'Priority 21', 'Priority description for Priority 21', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(28, 'Priority 22', 'Priority description for Priority 22', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20');

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

--
-- Table structure for table `matter_reasons`
--

DROP TABLE IF EXISTS `matter_reasons`;
CREATE TABLE IF NOT EXISTS `matter_reasons` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `name` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `created_by` bigint UNSIGNED DEFAULT NULL,
  `updated_by` bigint UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `matter_reasons_name_unique` (`name`),
  KEY `matter_reasons_created_by_foreign` (`created_by`),
  KEY `matter_reasons_updated_by_foreign` (`updated_by`)
) ENGINE=InnoDB AUTO_INCREMENT=36 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `matter_reasons`
--

INSERT INTO `matter_reasons` (`id`, `name`, `description`, `created_by`, `updated_by`, `created_at`, `updated_at`) VALUES
(1, 'Duplicate Case', 'The case was identified as a duplicate of an existing case and was therefore cancelled.', NULL, NULL, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(2, 'Cancelled by Request', 'The case was cancelled following a formal request by the reporting party.', NULL, NULL, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(3, 'Invalid Case', 'The case did not meet the minimum criteria required for processing.', NULL, NULL, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(4, 'Created in Error', 'The case was created due to a system or user error and has been cancelled.', NULL, NULL, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(5, 'No Jurisdiction', 'The case falls outside the organisation’s legal or operational jurisdiction.', NULL, NULL, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(6, 'Insufficient Evidence', 'The case was cancelled due to a lack of supporting evidence.', NULL, NULL, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(7, 'Resolved Externally', 'The matter was resolved outside the system prior to case processing.', NULL, NULL, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(8, 'Non-Responsive Party', 'The involved party failed to respond within the required timeframe.', NULL, NULL, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(9, 'Withdrawn by Initiator', 'The case was formally withdrawn by the individual who initiated it.', NULL, NULL, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(10, 'Policy Violation', 'The case conflicted with organisational policy and could not proceed.', NULL, NULL, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(11, 'Reason 1', 'Reason description for Reason 1', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(12, 'Reason 2', 'Reason description for Reason 2', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(13, 'Reason 3', 'Reason description for Reason 3', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(14, 'Reason 4', 'Reason description for Reason 4', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(15, 'Reason 5', 'Reason description for Reason 5', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(16, 'Reason 6', 'Reason description for Reason 6', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(17, 'Reason 7', 'Reason description for Reason 7', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(18, 'Reason 8', 'Reason description for Reason 8', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(19, 'Reason 9', 'Reason description for Reason 9', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(20, 'Reason 10', 'Reason description for Reason 10', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(21, 'Reason 11', 'Reason description for Reason 11', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(22, 'Reason 12', 'Reason description for Reason 12', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(23, 'Reason 13', 'Reason description for Reason 13', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(24, 'Reason 14', 'Reason description for Reason 14', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(25, 'Reason 15', 'Reason description for Reason 15', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(26, 'Reason 16', 'Reason description for Reason 16', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(27, 'Reason 17', 'Reason description for Reason 17', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(28, 'Reason 18', 'Reason description for Reason 18', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(29, 'Reason 19', 'Reason description for Reason 19', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(30, 'Reason 20', 'Reason description for Reason 20', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(31, 'Reason 21', 'Reason description for Reason 21', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(32, 'Reason 22', 'Reason description for Reason 22', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(33, 'Reason 23', 'Reason description for Reason 23', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(34, 'Reason 24', 'Reason description for Reason 24', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(35, 'Reason 25', 'Reason description for Reason 25', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20');

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

--
-- Table structure for table `matter_roles`
--

DROP TABLE IF EXISTS `matter_roles`;
CREATE TABLE IF NOT EXISTS `matter_roles` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `name` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `created_by` bigint UNSIGNED DEFAULT NULL,
  `updated_by` bigint UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `matter_roles_name_unique` (`name`),
  KEY `matter_roles_created_by_foreign` (`created_by`),
  KEY `matter_roles_updated_by_foreign` (`updated_by`)
) ENGINE=InnoDB AUTO_INCREMENT=34 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `matter_roles`
--

INSERT INTO `matter_roles` (`id`, `name`, `description`, `created_by`, `updated_by`, `created_at`, `updated_at`) VALUES
(1, 'Plaintiff', 'Party initiating the case', 0, 0, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(2, 'Defendant', 'Party responding to the case', 0, 0, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(3, 'Applicant', 'Party applying for legal relief', 0, 0, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(4, 'Respondent', 'Party responding to an application', 0, 0, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(5, 'Witness', 'Individual providing testimony', 0, 0, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(6, 'Third Party', 'External party involved in the case', 0, 0, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(7, 'Co-Plaintiff', 'Co-plaintiff on the case', 0, 0, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(8, 'Co-Defendant', 'Co-defendant on the case', 0, 0, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(9, 'Primary Client', 'Role description for Primary Client', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(10, 'Billing Contact', 'Role description for Billing Contact', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(11, 'Lead Lawyer', 'Role description for Lead Lawyer', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(12, 'Role 1', 'Role description for Role 1', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(13, 'Role 2', 'Role description for Role 2', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(14, 'Role 3', 'Role description for Role 3', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(15, 'Role 4', 'Role description for Role 4', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(16, 'Role 5', 'Role description for Role 5', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(17, 'Role 6', 'Role description for Role 6', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(18, 'Role 7', 'Role description for Role 7', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(19, 'Role 8', 'Role description for Role 8', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(20, 'Role 9', 'Role description for Role 9', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(21, 'Role 10', 'Role description for Role 10', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(22, 'Role 11', 'Role description for Role 11', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(23, 'Role 12', 'Role description for Role 12', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(24, 'Role 13', 'Role description for Role 13', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(25, 'Role 14', 'Role description for Role 14', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(26, 'Role 15', 'Role description for Role 15', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(27, 'Role 16', 'Role description for Role 16', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(28, 'Role 17', 'Role description for Role 17', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(29, 'Role 18', 'Role description for Role 18', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(30, 'Role 19', 'Role description for Role 19', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(31, 'Role 20', 'Role description for Role 20', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(32, 'Role 21', 'Role description for Role 21', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(33, 'Role 22', 'Role description for Role 22', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20');

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

--
-- Table structure for table `matter_statuses`
--

DROP TABLE IF EXISTS `matter_statuses`;
CREATE TABLE IF NOT EXISTS `matter_statuses` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `name` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `created_by` bigint UNSIGNED DEFAULT NULL,
  `updated_by` bigint UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `matter_statuses_name_unique` (`name`),
  KEY `matter_statuses_created_by_foreign` (`created_by`),
  KEY `matter_statuses_updated_by_foreign` (`updated_by`)
) ENGINE=InnoDB AUTO_INCREMENT=55 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `matter_statuses`
--

INSERT INTO `matter_statuses` (`id`, `name`, `description`, `created_by`, `updated_by`, `created_at`, `updated_at`) VALUES
(1, 'Closed', 'Status description for Closed', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(2, 'Intervened', 'government intervention (Code: INTVN)', NULL, NULL, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(3, 'Open', 'Status description for Open', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(4, 'Pending', 'Case is temporarily inactive or awaiting action (Code: PEND)', NULL, NULL, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(5, 'Transferred', 'Case has been transferred to another firm or court (Code: TRAN)', NULL, NULL, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(6, 'Withdrawn', 'Case was withdrawn by the client or counsel (Code: WDTH)', NULL, NULL, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(32, 'On Hold', 'Status description for On Hold', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(33, 'Status 1', 'Status description for Status 1', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(34, 'Status 2', 'Status description for Status 2', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(35, 'Status 3', 'Status description for Status 3', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(36, 'Status 4', 'Status description for Status 4', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(37, 'Status 5', 'Status description for Status 5', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(38, 'Status 6', 'Status description for Status 6', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(39, 'Status 7', 'Status description for Status 7', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(40, 'Status 8', 'Status description for Status 8', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(41, 'Status 9', 'Status description for Status 9', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(42, 'Status 10', 'Status description for Status 10', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(43, 'Status 11', 'Status description for Status 11', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(44, 'Status 12', 'Status description for Status 12', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(45, 'Status 13', 'Status description for Status 13', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(46, 'Status 14', 'Status description for Status 14', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(47, 'Status 15', 'Status description for Status 15', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(48, 'Status 16', 'Status description for Status 16', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(49, 'Status 17', 'Status description for Status 17', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(50, 'Status 18', 'Status description for Status 18', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(51, 'Status 19', 'Status description for Status 19', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(52, 'Status 20', 'Status description for Status 20', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(53, 'Status 21', 'Status description for Status 21', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(54, 'Status 22', 'Status description for Status 22', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20');

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

--
-- Table structure for table `matter_types`
--

DROP TABLE IF EXISTS `matter_types`;
CREATE TABLE IF NOT EXISTS `matter_types` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `name` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `created_by` bigint UNSIGNED DEFAULT NULL,
  `updated_by` bigint UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `matter_types_name_unique` (`name`),
  KEY `matter_types_created_by_foreign` (`created_by`),
  KEY `matter_types_updated_by_foreign` (`updated_by`)
) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `matter_types`
--

INSERT INTO `matter_types` (`id`, `name`, `description`, `created_by`, `updated_by`, `created_at`, `updated_at`) VALUES
(1, 'robbery', 'Illegal possession or taking of property using force or intimidations.', NULL, NULL, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(2, 'assault', 'Physical attack causing bodily harm or threat thereof', NULL, NULL, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(3, 'fraud', 'Deception intended to result in financial or personal gain', NULL, NULL, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(4, 'burglary', 'Unlawful entry into a structure with intent to commit a crime', NULL, NULL, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(5, 'theft', 'Unlawful taking of another person’s property without force', NULL, NULL, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(6, 'homicide', 'Unlawful killing of another human being', NULL, NULL, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(7, 'kidnapping', 'Unlawful abduction or detention of a person', NULL, NULL, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(8, 'domestic_violence', 'Abuse or violence occurring within a domestic relationship', NULL, NULL, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(9, 'drug_trafficking', 'Illegal manufacture, distribution, or sale of controlled substances', NULL, NULL, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(10, 'money_laundering', 'Concealment of the origins of illegally obtained money', NULL, NULL, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(11, 'cybercrime', 'Criminal activities carried out using computers or digital networksss', NULL, NULL, '2026-03-18 11:51:58', '2026-03-18 11:51:58'),
(12, 'Litigation', 'Type description for Litigation', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(13, 'Advisory', 'Type description for Advisory', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(14, 'Corporate', 'Type description for Corporate', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(15, 'Type 4', 'Type description for Type 4', 8, 8, '2026-03-19 11:04:56', '2026-03-19 11:04:56'),
(16, 'Type 5', 'Type description for Type 5', 8, 8, '2026-03-19 11:04:56', '2026-03-19 11:04:56'),
(17, 'Type 6', 'Type description for Type 6', 8, 8, '2026-03-19 11:04:56', '2026-03-19 11:04:56'),
(18, 'Type 7', 'Type description for Type 7', 8, 8, '2026-03-19 11:04:56', '2026-03-19 11:04:56'),
(19, 'Type 8', 'Type description for Type 8', 8, 8, '2026-03-19 11:04:56', '2026-03-19 11:04:56'),
(20, 'Type 9', 'Type description for Type 9', 8, 8, '2026-03-19 11:04:56', '2026-03-19 11:04:56'),
(21, 'Type 10', 'Type description for Type 10', 8, 8, '2026-03-19 11:04:56', '2026-03-19 11:04:56'),
(22, 'Type 11', 'Type description for Type 11', 8, 8, '2026-03-19 11:04:56', '2026-03-19 11:04:56'),
(23, 'Type 12', 'Type description for Type 12', 8, 8, '2026-03-19 11:04:56', '2026-03-19 11:04:56'),
(24, 'Type 13', 'Type description for Type 13', 8, 8, '2026-03-19 11:04:56', '2026-03-19 11:04:56'),
(25, 'Type 14', 'Type description for Type 14', 8, 8, '2026-03-19 11:04:56', '2026-03-19 11:04:56'),
(26, 'Type 15', 'Type description for Type 15', 8, 8, '2026-03-19 11:04:56', '2026-03-19 11:04:56'),
(27, 'Type 16', 'Type description for Type 16', 8, 8, '2026-03-19 11:04:56', '2026-03-19 11:04:56'),
(28, 'Type 17', 'Type description for Type 17', 8, 8, '2026-03-19 11:04:56', '2026-03-19 11:04:56'),
(29, 'Type 18', 'Type description for Type 18', 8, 8, '2026-03-19 11:04:56', '2026-03-19 11:04:56'),
(30, 'Type 19', 'Type description for Type 19', 8, 8, '2026-03-19 11:04:56', '2026-03-19 11:04:56'),
(31, 'Type 20', 'Type description for Type 20', 8, 8, '2026-03-19 11:04:56', '2026-03-19 11:04:56'),
(32, 'Type 21', 'Type description for Type 21', 8, 8, '2026-03-19 11:04:56', '2026-03-19 11:04:56'),
(33, 'Type 22', 'Type description for Type 22', 8, 8, '2026-03-19 11:04:56', '2026-03-19 11:04:56'),
(34, 'Type 23', 'Type description for Type 23', 8, 8, '2026-03-19 11:04:56', '2026-03-19 11:04:56'),
(35, 'Type 24', 'Type description for Type 24', 8, 8, '2026-03-19 11:04:56', '2026-03-19 11:04:56'),
(36, 'Type 25', 'Type description for Type 25', 8, 8, '2026-03-19 11:04:56', '2026-03-19 11:04:56'),
(37, 'Type 1', 'Type description for Type 1', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(38, 'Type 2', 'Type description for Type 2', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(39, 'Type 3', 'Type description for Type 3', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(40, 'Type 26', 'Type description for Type 26', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(41, 'Type 27', 'Type description for Type 27', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(42, 'Type 28', 'Type description for Type 28', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(43, 'Type 29', 'Type description for Type 29', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(44, 'Type 30', 'Type description for Type 30', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(45, 'Type 31', 'Type description for Type 31', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(46, 'Type 32', 'Type description for Type 32', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(47, 'Type 33', 'Type description for Type 33', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(48, 'Type 34', 'Type description for Type 34', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(49, 'Type 35', 'Type description for Type 35', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(50, 'Type 36', 'Type description for Type 36', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(51, 'Type 37', 'Type description for Type 37', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(52, 'Type 38', 'Type description for Type 38', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(53, 'Type 39', 'Type description for Type 39', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(54, 'Type 40', 'Type description for Type 40', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(55, 'Type 41', 'Type description for Type 41', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(56, 'Type 42', 'Type description for Type 42', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(57, 'Type 43', 'Type description for Type 43', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20'),
(58, 'Type 44', 'Type description for Type 44', 8, 8, '2026-03-19 11:10:20', '2026-03-19 11:10:20');

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

--
-- Table structure for table `migrations`
--

DROP TABLE IF EXISTS `migrations`;
CREATE TABLE IF NOT EXISTS `migrations` (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `migration` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `batch` int NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=146 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `migrations`
--

INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
(1, '2026_01_01_203350_create_account_types_table', 1),
(2, '2026_01_01_203350_create_assignments_table', 1),
(3, '2026_01_01_203350_create_audit_logs_table', 1),
(4, '2026_01_01_203350_create_cache_store_table', 1),
(5, '2026_01_01_203350_create_cancelled_reasons_table', 1),
(6, '2026_01_01_203350_create_case_categories_table', 1),
(7, '2026_01_01_203350_create_case_lawyers_table', 1),
(8, '2026_01_01_203350_create_case_parties_table', 1),
(9, '2026_01_01_203350_create_case_statuses_table', 1),
(10, '2026_01_01_203350_create_case_types_table', 1),
(11, '2026_01_01_203350_create_cases_table', 1),
(12, '2026_01_01_203350_create_chat_groups_table', 1),
(13, '2026_01_01_203350_create_chat_messages_table', 1),
(14, '2026_01_01_203350_create_chat_participants_table', 1),
(15, '2026_01_01_203350_create_chat_requests_table', 1),
(16, '2026_01_01_203350_create_chat_rooms_table', 1),
(17, '2026_01_01_203350_create_client_categories_table', 1),
(18, '2026_01_01_203350_create_client_journals_table', 1),
(19, '2026_01_01_203350_create_clients_table', 1),
(20, '2026_01_01_203350_create_company_info_table', 1),
(21, '2026_01_01_203350_create_court_areas_table', 1),
(22, '2026_01_01_203350_create_court_filing_statuses_table', 1),
(23, '2026_01_01_203350_create_court_filing_types_table', 1),
(24, '2026_01_01_203350_create_court_filings_table', 1),
(25, '2026_01_01_203350_create_court_types_table', 1),
(26, '2026_01_01_203350_create_currencies_table', 1),
(27, '2026_01_01_203350_create_currency_rates_table', 1),
(28, '2026_01_01_203350_create_departments_table', 1),
(29, '2026_01_01_203350_create_diary_entries_table', 1),
(30, '2026_01_01_203350_create_features_table', 1),
(31, '2026_01_01_203350_create_filing_responsible_lawyers_table', 1),
(32, '2026_01_01_203350_create_general_journals_table', 1),
(33, '2026_01_01_203350_create_general_ledger_accounts_table', 1),
(34, '2026_01_01_203350_create_group_call_participants_table', 1),
(35, '2026_01_01_203350_create_group_calls_table', 1),
(36, '2026_01_01_203350_create_home_currency_history_table', 1),
(37, '2026_01_01_203350_create_home_currency_table', 1),
(38, '2026_01_01_203350_create_journal_transactions_table', 1),
(39, '2026_01_01_203350_create_judgements_table', 1),
(40, '2026_01_01_203350_create_judges_table', 1),
(41, '2026_01_01_203350_create_lawyer_groups_table', 1),
(42, '2026_01_01_203350_create_lawyer_tariffs_table', 1),
(43, '2026_01_01_203350_create_lawyer_types_table', 1),
(44, '2026_01_01_203350_create_lawyers_table', 1),
(45, '2026_01_01_203350_create_modules_table', 1),
(46, '2026_01_01_203350_create_notifications_table', 1),
(47, '2026_01_01_203350_create_password_otps_table', 1),
(48, '2026_01_01_203350_create_password_resets_table', 1),
(49, '2026_01_01_203350_create_permissions_table', 1),
(50, '2026_01_01_203350_create_prompt_conversations_table', 1),
(51, '2026_01_01_203350_create_prompt_messages_table', 1),
(52, '2026_01_01_203350_create_prompt_templates_table', 1),
(53, '2026_01_01_203350_create_prompts_table', 1),
(54, '2026_01_01_203350_create_role_permissions_table', 1),
(55, '2026_01_01_203350_create_subaccounts_table', 1),
(56, '2026_01_01_203350_create_submodules_table', 1),
(57, '2026_01_01_203350_create_supplier_ageing_analysis_table', 1),
(58, '2026_01_01_203350_create_supplier_areas_table', 1),
(59, '2026_01_01_203350_create_supplier_categories_table', 1),
(60, '2026_01_01_203350_create_supplier_journals_table', 1),
(61, '2026_01_01_203350_create_suppliers_table', 1),
(62, '2026_01_01_203350_create_system_settings_categories_table', 1),
(63, '2026_01_01_203350_create_system_settings_history_table', 1),
(64, '2026_01_01_203350_create_system_settings_table', 1),
(65, '2026_01_01_203350_create_taxes_table', 1),
(66, '2026_01_01_203350_create_transactions_table', 1),
(67, '2026_01_01_203350_create_uploaded_chat_files_table', 1),
(68, '2026_01_01_203350_create_user_chat_settings_table', 1),
(69, '2026_01_01_203350_create_user_groups_table', 1),
(70, '2026_01_01_203350_create_user_phones_table', 1),
(71, '2026_01_01_203350_create_user_roles_table', 1),
(72, '2026_01_01_203350_create_user_sessions_table', 1),
(73, '2026_01_01_203350_create_user_tiers_table', 1),
(74, '2026_01_01_203350_create_users_table', 1),
(75, '2026_01_01_203353_add_foreign_keys_to_password_resets_table', 1),
(76, '2026_01_01_203353_add_foreign_keys_to_prompt_conversations_table', 1),
(77, '2026_01_01_203353_add_foreign_keys_to_prompt_messages_table', 1),
(78, '2026_01_01_203353_add_foreign_keys_to_prompt_templates_table', 1),
(79, '2026_01_01_203353_add_foreign_keys_to_prompts_table', 1),
(80, '2026_01_01_204638_create_sessions_table', 1),
(81, '2026_01_03_072509_create_sessions_table', 2),
(82, '2025_09_20_000001_add_gl_account_to_cashbooks_table', 3),
(83, '2025_09_21_000001_create_client_invoice_disbursements_table', 4),
(84, '2026_03_09_160100_make_client_optional_on_client_quotations_table', 5),
(85, '2025_09_22_000001_create_client_invoice_taxes_table', 6),
(86, '2024_10_01_000000_add_accountability_columns_to_chat_tables', 7),
(94, '2026_03_16_000001_create_matter_lookup_tables', 8),
(95, '2026_03_16_000002_create_matters_table', 9),
(96, '2026_03_16_000003_create_matter_clients_table', 10),
(97, '2026_03_16_000004_create_matter_lawyers_table', 11),
(98, '2026_03_16_000006_create_conflict_tables', 12),
(99, '2026_03_16_000007_migrate_cases_to_matters', 13),
(100, '2026_03_22_210000_add_conflict_resolution_columns', 14),
(101, '2026_03_22_213000_add_matter_numbering_to_system_settings', 15),
(102, '2026_03_23_000001_create_account_types_table', 16),
(103, '2026_03_23_000002_create_departments_table', 16),
(104, '2026_03_23_000003_create_general_ledger_accounts_table', 16),
(105, '2026_03_23_000004_create_journal_headers_table', 16),
(106, '2026_03_23_000005_create_journal_lines_table', 16),
(107, '2026_03_23_000006_create_cashbooks_table', 16),
(108, '2026_03_23_000007_create_cashbook_entries_table', 16),
(109, '2026_03_23_000008_create_client_trust_accounts_table', 17),
(110, '2026_03_23_000009_create_trust_transactions_table', 17),
(111, '2026_03_23_000010_create_trust_ledger_entries_table', 17),
(112, '2026_03_23_000011_create_trust_account_reconciliations_table', 17),
(113, '2026_03_23_000012_create_trust_transfers_table', 17),
(114, '2026_03_24_130001_add_trust_account_id_to_cashbooks_table', 18),
(115, '2026_03_24_140001_create_trust_account_matters_table', 19),
(116, '2026_03_24_230001_drop_matter_id_from_client_trust_accounts_table', 20),
(118, '2026_03_25_000001_create_cashbook_entries_table', 21),
(119, '2026_03_26_130001_replace_user_id_with_audit_fields_on_client_invoices_table', 22),
(120, '2026_03_26_130002_replace_user_id_with_audit_fields_on_client_quotations_table', 22),
(121, '2026_03_26_130003_replace_user_id_with_audit_fields_on_client_receipts_table', 22),
(122, '2026_03_26_150000_add_client_quotations_and_receipts_permission_features', 23),
(123, '2026_03_26_151000_add_print_permission_features_for_client_billing', 24),
(124, '2026_03_26_152000_remove_print_permission_features_for_client_billing', 25),
(125, '2026_03_26_203000_add_foreign_key_columns_to_general_journals_table', 26),
(127, '2026_03_27_000001_create_supplier_invoice_lines_and_seed_invoices', 27),
(128, '2026_03_27_000002_seed_court_reference_data_and_filings', 28),
(129, '2026_03_30_000001_drop_bank_name_from_cashbooks_table', 29),
(130, '2026_04_01_130000_drop_assignments_module', 30),
(131, '2026_04_01_141000_drop_court_filings_tables', 31),
(132, '2026_04_02_123409_recreate_vw_active_tariffs_view', 32),
(133, '2026_04_02_153301_add_status_indexes_soft_deletes_to_diaries_table', 33),
(136, '2026_04_02_153354_create_diary_categories_table', 34),
(137, '2026_04_02_153421_create_diary_tags_table', 34),
(138, '2026_04_02_180000_create_client_invoice_gl_accounts_table', 35),
(139, '2026_04_02_153100_create_diary_categories_table', 36),
(140, '2026_04_02_153200_create_diary_tags_table', 36),
(141, '2026_04_02_153300_create_diaries_table', 36),
(142, '2026_04_02_153445_create_diary_entry_tags_table', 37),
(143, '2026_04_02_153514_create_diary_attachments_table', 37),
(144, '2026_04_02_153617_create_diary_reminders_table', 37),
(145, '2026_04_02_180010_add_gl_account_id_to_client_invoice_disbursements_table', 37);

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

--
-- Table structure for table `modules`
--

DROP TABLE IF EXISTS `modules`;
CREATE TABLE IF NOT EXISTS `modules` (
  `module_id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `module_name` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  PRIMARY KEY (`module_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `notifications`
--

DROP TABLE IF EXISTS `notifications`;
CREATE TABLE IF NOT EXISTS `notifications` (
  `notification_id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `user_id` bigint UNSIGNED NOT NULL,
  `type` enum('message','call','group','request','system') COLLATE utf8mb4_unicode_ci DEFAULT 'message',
  `title` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `content` text COLLATE utf8mb4_unicode_ci,
  `related_id` bigint UNSIGNED DEFAULT NULL,
  `related_type` enum('chat','call','group','system') COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `is_read` tinyint(1) DEFAULT '0',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `read_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`notification_id`),
  KEY `user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `password_otps`
--

DROP TABLE IF EXISTS `password_otps`;
CREATE TABLE IF NOT EXISTS `password_otps` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `otp` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL,
  `expires_at` datetime NOT NULL,
  `used` tinyint(1) NOT NULL DEFAULT '0',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_email_otp` (`email`,`otp`),
  KEY `idx_email` (`email`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `password_otps`
--

INSERT INTO `password_otps` (`id`, `email`, `otp`, `expires_at`, `used`, `created_at`, `updated_at`) VALUES
(1, 'tadiashley2003@gmail.com', '532847', '2026-01-03 09:25:05', 0, '2026-01-03 07:15:05', '2026-01-03 09:15:05'),
(3, 'tadiwagwena@melsoftzim.co.zw', '597023', '2026-01-03 09:49:53', 0, '2026-01-03 07:39:53', '2026-01-03 09:39:53');

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

--
-- Table structure for table `password_resets`
--

DROP TABLE IF EXISTS `password_resets`;
CREATE TABLE IF NOT EXISTS `password_resets` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `user_id` bigint UNSIGNED NOT NULL,
  `token_hash` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `expires_at` timestamp NOT NULL,
  `used` tinyint(1) NOT NULL DEFAULT '0',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `token_hash` (`token_hash`),
  KEY `idx_user_id_used` (`user_id`,`used`),
  KEY `idx_expires_at` (`expires_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `permission_audit_log`
--

DROP TABLE IF EXISTS `permission_audit_log`;
CREATE TABLE IF NOT EXISTS `permission_audit_log` (
  `log_id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `entity_type` enum('user','group','tier') COLLATE utf8mb4_unicode_ci NOT NULL,
  `entity_id` bigint UNSIGNED NOT NULL,
  `feature_id` bigint UNSIGNED NOT NULL,
  `old_values` json DEFAULT NULL,
  `new_values` json NOT NULL,
  `action` enum('created','updated','deleted','activated','deactivated') COLLATE utf8mb4_unicode_ci NOT NULL,
  `changed_by` bigint UNSIGNED NOT NULL,
  `ip_address` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `user_agent` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `changed_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`log_id`),
  KEY `idx_audit_entity` (`entity_type`,`entity_id`),
  KEY `idx_audit_feature` (`feature_id`),
  KEY `idx_audit_changed_by` (`changed_by`),
  KEY `idx_audit_changed_at` (`changed_at`)
) ENGINE=InnoDB AUTO_INCREMENT=196 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `permission_audit_log`
--

INSERT INTO `permission_audit_log` (`log_id`, `entity_type`, `entity_id`, `feature_id`, `old_values`, `new_values`, `action`, `changed_by`, `ip_address`, `user_agent`, `changed_at`) VALUES
(1, 'user', 1, 1, NULL, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'created', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:18:39'),
(2, 'user', 1, 2, NULL, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'created', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:18:39'),
(3, 'user', 1, 3, NULL, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'created', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:18:39'),
(4, 'user', 1, 4, NULL, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'created', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:18:39'),
(5, 'user', 1, 5, NULL, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'created', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:18:39'),
(6, 'user', 1, 6, NULL, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'created', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:18:39'),
(7, 'user', 1, 7, NULL, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'created', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:18:39'),
(8, 'user', 1, 8, NULL, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'created', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:18:39'),
(9, 'user', 1, 9, NULL, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'created', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:18:39'),
(10, 'user', 1, 10, NULL, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'created', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:18:39'),
(11, 'user', 1, 11, NULL, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'created', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:18:39'),
(12, 'user', 1, 12, NULL, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'created', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:18:39'),
(13, 'user', 1, 13, NULL, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'created', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:18:39'),
(14, 'user', 1, 14, NULL, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'created', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:18:39'),
(15, 'user', 1, 15, NULL, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'created', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:18:39'),
(16, 'user', 1, 16, NULL, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'created', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:18:39'),
(17, 'user', 1, 17, NULL, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'created', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:18:39'),
(18, 'user', 1, 18, NULL, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'created', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:18:39'),
(19, 'user', 1, 19, NULL, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'created', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:18:39'),
(20, 'user', 1, 20, NULL, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": false, \"can_export\": false, \"can_approve\": false}', 'created', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:18:39'),
(21, 'user', 1, 21, NULL, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": false, \"can_export\": false, \"can_approve\": false}', 'created', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:18:39'),
(22, 'user', 1, 22, NULL, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'created', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:18:39'),
(23, 'user', 1, 23, NULL, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'created', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:18:39'),
(24, 'user', 1, 24, NULL, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'created', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:18:39'),
(25, 'user', 1, 25, NULL, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'created', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:18:39'),
(26, 'user', 1, 26, NULL, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'created', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:18:39'),
(27, 'user', 1, 27, NULL, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'created', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:18:39'),
(28, 'user', 1, 28, NULL, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'created', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:18:39'),
(29, 'user', 1, 29, NULL, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'created', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:18:39'),
(30, 'user', 1, 30, NULL, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'created', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:18:39'),
(31, 'user', 1, 31, NULL, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'created', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:18:39'),
(32, 'user', 1, 32, NULL, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'created', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:18:39'),
(33, 'user', 1, 33, NULL, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'created', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:18:39'),
(34, 'user', 1, 34, NULL, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'created', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:18:39'),
(35, 'user', 1, 35, NULL, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'created', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:18:39'),
(36, 'user', 1, 36, NULL, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'created', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:18:39'),
(37, 'user', 1, 37, NULL, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'created', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:18:39'),
(38, 'user', 1, 38, NULL, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'created', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:18:39'),
(39, 'user', 1, 39, NULL, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'created', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:18:40'),
(40, 'user', 1, 40, NULL, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'created', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:18:40'),
(41, 'user', 1, 41, NULL, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'created', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:18:40'),
(42, 'user', 1, 42, NULL, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'created', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:18:40'),
(43, 'user', 1, 43, NULL, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'created', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:18:40'),
(44, 'user', 1, 44, NULL, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'created', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:18:40'),
(45, 'user', 1, 45, NULL, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'created', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:18:40'),
(46, 'user', 1, 46, NULL, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'created', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:18:40'),
(47, 'user', 1, 47, NULL, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'created', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:18:40'),
(48, 'user', 1, 48, NULL, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": false, \"can_export\": false, \"can_approve\": false}', 'created', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:18:40'),
(49, 'user', 1, 1, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:52:37'),
(50, 'user', 1, 2, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:52:37'),
(51, 'user', 1, 3, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:52:37'),
(52, 'user', 1, 4, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:52:37'),
(53, 'user', 1, 5, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:52:37'),
(54, 'user', 1, 6, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:52:37'),
(55, 'user', 1, 7, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:52:37'),
(56, 'user', 1, 8, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:52:37'),
(57, 'user', 1, 9, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:52:37'),
(58, 'user', 1, 10, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:52:37'),
(59, 'user', 1, 11, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:52:37'),
(60, 'user', 1, 12, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:52:37'),
(61, 'user', 1, 13, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:52:37'),
(62, 'user', 1, 14, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:52:37'),
(63, 'user', 1, 15, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:52:37'),
(64, 'user', 1, 16, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:52:37'),
(65, 'user', 1, 17, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:52:37'),
(66, 'user', 1, 18, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:52:37'),
(67, 'user', 1, 19, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:52:37'),
(68, 'user', 1, 20, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": false, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": false, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:52:37'),
(69, 'user', 1, 21, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": false, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": false, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:52:37'),
(70, 'user', 1, 22, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:52:37'),
(71, 'user', 1, 23, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:52:37'),
(72, 'user', 1, 24, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:52:37'),
(73, 'user', 1, 25, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:52:37'),
(74, 'user', 1, 26, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:52:37'),
(75, 'user', 1, 27, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:52:37'),
(76, 'user', 1, 28, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:52:37'),
(77, 'user', 1, 29, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:52:37'),
(78, 'user', 1, 30, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:52:37'),
(79, 'user', 1, 31, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:52:37'),
(80, 'user', 1, 32, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:52:37'),
(81, 'user', 1, 33, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:52:37'),
(82, 'user', 1, 34, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:52:37'),
(83, 'user', 1, 35, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:52:37'),
(84, 'user', 1, 36, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:52:37'),
(85, 'user', 1, 37, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:52:37'),
(86, 'user', 1, 38, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:52:37'),
(87, 'user', 1, 39, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:52:37'),
(88, 'user', 1, 40, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:52:37'),
(89, 'user', 1, 41, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:52:37'),
(90, 'user', 1, 42, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:52:37'),
(91, 'user', 1, 43, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:52:37'),
(92, 'user', 1, 44, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:52:37'),
(93, 'user', 1, 45, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:52:37'),
(94, 'user', 1, 46, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:52:37'),
(95, 'user', 1, 47, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:52:37'),
(96, 'user', 1, 48, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": false, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": false, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 11:52:37'),
(100, 'user', 1, 1, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:44:09'),
(101, 'user', 1, 2, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:44:09'),
(102, 'user', 1, 3, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:44:09'),
(103, 'user', 1, 4, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:44:09'),
(104, 'user', 1, 5, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:44:09'),
(105, 'user', 1, 6, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:44:09'),
(106, 'user', 1, 7, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:44:09'),
(107, 'user', 1, 8, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:44:09'),
(108, 'user', 1, 9, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:44:09'),
(109, 'user', 1, 10, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:44:09'),
(110, 'user', 1, 11, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:44:09'),
(111, 'user', 1, 12, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:44:09'),
(112, 'user', 1, 13, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:44:09'),
(113, 'user', 1, 14, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:44:09'),
(114, 'user', 1, 15, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:44:09'),
(115, 'user', 1, 16, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:44:10'),
(116, 'user', 1, 17, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:44:10'),
(117, 'user', 1, 18, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:44:10'),
(118, 'user', 1, 19, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:44:10');
INSERT INTO `permission_audit_log` (`log_id`, `entity_type`, `entity_id`, `feature_id`, `old_values`, `new_values`, `action`, `changed_by`, `ip_address`, `user_agent`, `changed_at`) VALUES
(119, 'user', 1, 20, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": false, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": true, \"can_delete\": false, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:44:10'),
(120, 'user', 1, 21, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": false, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": true, \"can_delete\": false, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:44:10'),
(121, 'user', 1, 22, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:44:10'),
(122, 'user', 1, 23, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:44:10'),
(123, 'user', 1, 24, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:44:10'),
(124, 'user', 1, 25, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:44:10'),
(125, 'user', 1, 26, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:44:10'),
(126, 'user', 1, 27, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:44:10'),
(127, 'user', 1, 28, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:44:10'),
(128, 'user', 1, 29, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:44:10'),
(129, 'user', 1, 30, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:44:10'),
(130, 'user', 1, 31, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:44:10'),
(131, 'user', 1, 32, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:44:10'),
(132, 'user', 1, 33, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:44:10'),
(133, 'user', 1, 34, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:44:10'),
(134, 'user', 1, 35, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:44:10'),
(135, 'user', 1, 36, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:44:10'),
(136, 'user', 1, 37, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:44:10'),
(137, 'user', 1, 38, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:44:10'),
(138, 'user', 1, 39, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:44:10'),
(139, 'user', 1, 40, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:44:10'),
(140, 'user', 1, 41, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:44:10'),
(141, 'user', 1, 42, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:44:10'),
(142, 'user', 1, 43, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:44:10'),
(143, 'user', 1, 44, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:44:10'),
(144, 'user', 1, 45, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:44:10'),
(145, 'user', 1, 46, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:44:10'),
(146, 'user', 1, 47, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": true, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:44:10'),
(147, 'user', 1, 48, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": false, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": true, \"can_delete\": false, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:44:10'),
(148, 'user', 1, 1, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:45:13'),
(149, 'user', 1, 2, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:45:13'),
(150, 'user', 1, 3, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:45:13'),
(151, 'user', 1, 4, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:45:13'),
(152, 'user', 1, 5, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:45:13'),
(153, 'user', 1, 6, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:45:13'),
(154, 'user', 1, 7, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:45:13'),
(155, 'user', 1, 8, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:45:13'),
(156, 'user', 1, 9, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:45:13'),
(157, 'user', 1, 10, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:45:13'),
(158, 'user', 1, 11, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:45:13'),
(159, 'user', 1, 12, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:45:13'),
(160, 'user', 1, 13, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:45:13'),
(161, 'user', 1, 14, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:45:13'),
(162, 'user', 1, 15, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:45:13'),
(163, 'user', 1, 16, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:45:13'),
(164, 'user', 1, 17, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:45:13'),
(165, 'user', 1, 18, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:45:13'),
(166, 'user', 1, 19, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:45:13'),
(167, 'user', 1, 20, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": true, \"can_delete\": false, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": true, \"can_delete\": false, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:45:13'),
(168, 'user', 1, 21, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": true, \"can_delete\": false, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": true, \"can_delete\": false, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:45:13'),
(169, 'user', 1, 22, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:45:13'),
(170, 'user', 1, 23, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:45:13'),
(171, 'user', 1, 24, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:45:13'),
(172, 'user', 1, 25, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:45:13'),
(173, 'user', 1, 26, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:45:13'),
(174, 'user', 1, 27, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:45:13'),
(175, 'user', 1, 28, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:45:13'),
(176, 'user', 1, 29, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:45:13'),
(177, 'user', 1, 30, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:45:13'),
(178, 'user', 1, 31, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:45:13'),
(179, 'user', 1, 32, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:45:13'),
(180, 'user', 1, 33, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:45:13'),
(181, 'user', 1, 34, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:45:13'),
(182, 'user', 1, 35, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:45:13'),
(183, 'user', 1, 36, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:45:13'),
(184, 'user', 1, 37, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:45:13'),
(185, 'user', 1, 38, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:45:13'),
(186, 'user', 1, 39, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:45:13'),
(187, 'user', 1, 40, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:45:13'),
(188, 'user', 1, 41, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:45:13'),
(189, 'user', 1, 42, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:45:13'),
(190, 'user', 1, 43, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:45:13'),
(191, 'user', 1, 44, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:45:14'),
(192, 'user', 1, 45, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:45:14'),
(193, 'user', 1, 46, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": false, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:45:14'),
(194, 'user', 1, 47, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": true, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": true, \"can_delete\": true, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:45:14'),
(195, 'user', 1, 48, '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": true, \"can_delete\": false, \"can_export\": false, \"can_approve\": false}', '{\"can_add\": true, \"can_edit\": true, \"can_view\": true, \"can_print\": true, \"can_delete\": false, \"can_export\": false, \"can_approve\": false}', 'updated', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-03-26 12:45:14');

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

--
-- Table structure for table `permission_features`
--

DROP TABLE IF EXISTS `permission_features`;
CREATE TABLE IF NOT EXISTS `permission_features` (
  `feature_id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `module_id` bigint UNSIGNED NOT NULL,
  `feature_name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `feature_slug` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `feature_description` text COLLATE utf8mb4_unicode_ci,
  `default_view` tinyint(1) NOT NULL DEFAULT '0',
  `default_add` tinyint(1) NOT NULL DEFAULT '0',
  `default_edit` tinyint(1) NOT NULL DEFAULT '0',
  `default_delete` tinyint(1) NOT NULL DEFAULT '0',
  `default_export` tinyint(1) NOT NULL DEFAULT '0',
  `default_print` tinyint(1) NOT NULL DEFAULT '0',
  `default_approve` tinyint(1) NOT NULL DEFAULT '0',
  `is_restricted` tinyint(1) NOT NULL DEFAULT '0',
  `requires_approval` tinyint(1) NOT NULL DEFAULT '0',
  `display_order` smallint UNSIGNED NOT NULL DEFAULT '0',
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`feature_id`),
  UNIQUE KEY `uq_feature_slug` (`feature_slug`),
  KEY `idx_feature_module` (`module_id`),
  KEY `idx_feature_active` (`is_active`)
) ENGINE=InnoDB AUTO_INCREMENT=52 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `permission_features`
--

INSERT INTO `permission_features` (`feature_id`, `module_id`, `feature_name`, `feature_slug`, `feature_description`, `default_view`, `default_add`, `default_edit`, `default_delete`, `default_export`, `default_print`, `default_approve`, `is_restricted`, `requires_approval`, `display_order`, `is_active`, `created_at`, `updated_at`) VALUES
(1, 1, 'General Ledger', 'general-ledger', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(2, 1, 'Account Types', 'account-types', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(3, 1, 'Departments', 'departments', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(4, 1, 'Cashbooks', 'cashbooks', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(5, 1, 'Sub Accounts', 'sub-accounts', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(6, 1, 'Multi Currency', 'multi-currency', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(7, 1, 'Taxes', 'taxes', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(8, 1, 'Suppliers', 'suppliers', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(9, 1, 'Clients', 'clients', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(10, 1, 'Lawyers', 'lawyers', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(11, 1, 'Cases', 'cases', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(12, 1, 'Court Areas', 'court-areas', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(13, 1, 'Court Types', 'court-types', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(14, 1, 'Judges', 'judges', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(15, 1, 'Judgements', 'judgements', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(16, 1, 'Tariffs', 'tariffs', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(17, 2, 'Assignments', 'assignments', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(18, 2, 'Diary', 'diary', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(19, 2, 'Court Filings', 'court-filings', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(20, 2, 'Client Invoices', 'client-invoices', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(21, 2, 'Supplier Invoices', 'supplier-invoices', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(22, 2, 'Cashbook', 'cashbook', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(23, 2, 'Journals', 'journals', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(24, 3, 'Cashbook Reports', 'cashbook-reports', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(25, 3, 'Client Statements', 'client-statements', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(26, 3, 'Case Status', 'case-status', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(27, 3, 'Court Filings Reports', 'court-filings-reports', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(28, 3, 'Lawyer Statements', 'lawyer-statements', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(29, 3, 'Supplier Statements', 'supplier-statements', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(30, 3, 'Tax Reports', 'tax-reports', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(31, 3, 'Fee Collection', 'fee-collection', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(32, 3, 'Outstanding Fees', 'outstanding-fees', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(33, 3, 'Total Fees', 'total-fees', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(34, 3, 'Income Statements', 'income-statements', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(35, 3, 'Balance Sheet', 'balance-sheet', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(36, 3, 'Trial Balance', 'trial-balance', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(37, 3, 'Journals Reports', 'journals-reports', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(38, 3, 'General Ledger Reports', 'general-ledger-reports', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(39, 3, 'Chart Of Accounts', 'chart-of-accounts', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(40, 4, 'Chat View', 'chat-view', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(41, 4, 'Chat Send', 'chat-send', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(42, 4, 'Chat Manage', 'chat-manage', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(43, 5, 'Lexa AI Assistant', 'lexa-ai', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(44, 6, 'User Management', 'user-management', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(45, 6, 'System Settings', 'system-settings', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(46, 6, 'Approvals', 'approvals', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(47, 2, 'Client Quotations', 'client-quotations', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 1, '2026-03-26 13:02:47', '2026-03-26 13:02:47'),
(48, 2, 'Client Receipts', 'client-receipts', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 1, '2026-03-26 13:02:47', '2026-03-26 13:02:47');

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

--
-- Table structure for table `permission_modules`
--

DROP TABLE IF EXISTS `permission_modules`;
CREATE TABLE IF NOT EXISTS `permission_modules` (
  `module_id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `module_name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `module_slug` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `module_description` text COLLATE utf8mb4_unicode_ci,
  `module_icon` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `parent_module_id` bigint UNSIGNED DEFAULT NULL,
  `display_order` smallint UNSIGNED NOT NULL DEFAULT '0',
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`module_id`),
  UNIQUE KEY `uq_module_slug` (`module_slug`),
  KEY `idx_module_parent` (`parent_module_id`),
  KEY `idx_module_active` (`is_active`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `permission_modules`
--

INSERT INTO `permission_modules` (`module_id`, `module_name`, `module_slug`, `module_description`, `module_icon`, `parent_module_id`, `display_order`, `is_active`, `created_at`, `updated_at`) VALUES
(1, 'Edit Modules', 'edit-modules', NULL, NULL, NULL, 1, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(2, 'Processing Modules', 'processing-modules', NULL, NULL, NULL, 2, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(3, 'Reports Modules', 'reports-modules', NULL, NULL, NULL, 3, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(4, 'Chat Room', 'chat-room', NULL, NULL, NULL, 4, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(5, 'Lexa AI Assistant', 'lexa-ai', NULL, NULL, NULL, 5, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47'),
(6, 'Administration', 'administration', NULL, NULL, NULL, 6, 1, '2026-02-26 11:55:47', '2026-02-26 11:55:47');

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

--
-- Table structure for table `sessions`
--

DROP TABLE IF EXISTS `sessions`;
CREATE TABLE IF NOT EXISTS `sessions` (
  `session_token` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
  `user_id` bigint UNSIGNED NOT NULL,
  `ip_address` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `user_agent` text COLLATE utf8mb4_unicode_ci,
  `login_time` timestamp NULL DEFAULT NULL,
  `last_activity` timestamp NULL DEFAULT NULL,
  `expires_at` timestamp NULL DEFAULT NULL,
  `status` enum('active','inactive') COLLATE utf8mb4_unicode_ci DEFAULT 'active',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`session_token`),
  KEY `sessions_user_id_foreign` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `sessions`
--

INSERT INTO `sessions` (`session_token`, `user_id`, `ip_address`, `user_agent`, `login_time`, `last_activity`, `expires_at`, `status`, `created_at`, `updated_at`) VALUES
('122sDwtHDypi6myU8xDiHoDOAIUOuK6ka1p3HbIYIEmAL1xU6VJ3iFOxBHnuWtMh', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-04-07 05:43:30', '2026-04-07 05:43:31', '2026-04-07 07:43:30', 'active', '2026-04-07 05:43:30', '2026-04-07 05:43:31'),
('1lENULLogtOHKMyek5yFlsw9inarCV6GE7OATz9eBPgSvO8GC0E8UGapo1XVCW2T', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-04-07 06:13:24', '2026-04-07 07:00:26', '2026-04-07 08:13:24', 'active', '2026-04-07 06:13:24', '2026-04-07 07:00:26'),
('964d7x38NHOlEIDltU5P4jkWVcRXYeOXGmLQbm1JAO8eyZMeKaI5okMtv6apLWkw', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-04-07 05:29:05', '2026-04-07 05:29:05', '2026-04-07 07:29:05', 'active', '2026-04-07 05:29:05', '2026-04-07 05:29:05'),
('kCb2w7DPCcnbj55FFilnbbTbrEpstgfNSp2eogLY4xx9hYzgGoL3WWvQ86qvwlld', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-04-02 11:10:52', '2026-04-02 13:08:27', '2026-04-02 13:10:52', 'active', '2026-04-02 11:10:52', '2026-04-02 13:08:27'),
('XaGHcq9xYShxNq4H5QvqpFcAFVbYMvTPCXNvKIv9QVNm18RMC1D7ylI6wTurXOhq', 1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-04-06 06:20:10', '2026-04-06 06:20:12', '2026-04-06 08:20:10', 'active', '2026-04-06 06:20:10', '2026-04-06 06:20:12');

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

--
-- Table structure for table `suppliers`
--

DROP TABLE IF EXISTS `suppliers`;
CREATE TABLE IF NOT EXISTS `suppliers` (
  `supplier_id` int NOT NULL AUTO_INCREMENT,
  `supplier_code` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `supplier_name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `full_name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `contact_person` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `contact_1` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `contact_2` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `email` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `address` text COLLATE utf8mb4_unicode_ci,
  `category_id` int DEFAULT NULL,
  `age_analysis_id` int DEFAULT NULL,
  `area_id` int DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`supplier_id`),
  UNIQUE KEY `supplier_code` (`supplier_code`),
  KEY `fk_supplier_category` (`category_id`),
  KEY `fk_supplier_ageing` (`age_analysis_id`),
  KEY `fk_supplier_area` (`area_id`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `suppliers`
--

INSERT INTO `suppliers` (`supplier_id`, `supplier_code`, `supplier_name`, `full_name`, `contact_person`, `contact_1`, `contact_2`, `email`, `address`, `category_id`, `age_analysis_id`, `area_id`, `created_at`, `updated_at`) VALUES
(1, 'SUP-001', 'Alpha Supplies', 'Alpha Supplies Pvt Ltd', 'John Moyo', '+263771000001', NULL, 'info@alphasupplies.com', '12 Samora Machel Ave, Harare', 1, NULL, 1, '2026-01-07 09:06:37', '2026-01-07 09:06:37'),
(2, 'SUP-002', 'Beta Traders', 'Beta Traders Zimbabwe', 'Sarah Dube', '+263771000002', '+263242700002', 'sales@betatraders.co.zw', '45 Jason Moyo St, Bulawayo', 2, NULL, 2, '2026-01-07 09:06:37', '2026-01-07 09:06:37'),
(3, 'SUP-003', 'Gamma Industries', 'Gamma Industries Ltd', 'Tawanda Chirwa', '+263771000003', NULL, 'contact@gamma.co.zw', '7 Coventry Rd, Workington', 1, NULL, 3, '2026-01-07 09:06:37', '2026-01-07 09:06:37'),
(4, 'SUP-004', 'Delta Logistics', 'Delta Logistics Services', 'Nomsa Ncube', '+263771000004', NULL, 'admin@deltalogistics.com', '88 Airport Rd, Harare', 3, NULL, 1, '2026-01-07 09:06:37', '2026-01-07 09:06:37'),
(5, 'SUP-005', 'Epsilon Holdings', 'Epsilon Holdings Africa', 'Brian Zhou', '+263771000005', '+263242700005', 'info@epsilon.africa', '102 Enterprise Rd, Harare', 2, NULL, 1, '2026-01-07 09:06:37', '2026-01-07 09:06:37'),
(6, 'SUP-006', 'Zeta Chemicals', 'Zeta Chemicals Pvt Ltd', 'Farai Mutasa', '+263771000006', NULL, 'support@zetachem.co.zw', '15 Tilbury Rd, Willowvale', 4, NULL, 3, '2026-01-07 09:06:37', '2026-01-07 09:06:37'),
(7, 'SUP-007', 'Eta Engineering', 'Eta Engineering Services', 'Clive Banda', '+263771000007', NULL, 'projects@etaeng.co.zw', '22 Seke Rd, Harare', 3, NULL, 2, '2026-01-07 09:06:37', '2026-01-07 09:06:37'),
(8, 'SUP-008', 'Theta Foods', 'Theta Foods & Catering', 'Rudo Mahachi', '+263771000008', '+263242700008', 'orders@thetafoods.co.zw', '9 Chinhoyi St, Gweru', 5, NULL, 4, '2026-01-07 09:06:37', '2026-01-07 09:06:37'),
(9, 'SUP-009', 'Iota Technologies', 'Iota Technologies Zimbabwe', 'Kudzai Marume', '+263771000009', NULL, 'hello@iotatech.co.zw', '60 Borrowdale Rd, Harare', 6, NULL, 1, '2026-01-07 09:06:37', '2026-01-07 09:06:37'),
(10, 'SUP-010', 'Kappa Medical', 'Kappa Medical Supplies', 'Dr. L. Nyathi', '+263771000010', NULL, 'procurement@kappamed.co.zw', '14 Hospital Rd, Mutare', 7, NULL, 5, '2026-01-07 09:06:37', '2026-01-07 09:06:37');

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

--
-- Table structure for table `supplier_ageing_analysis`
--

DROP TABLE IF EXISTS `supplier_ageing_analysis`;
CREATE TABLE IF NOT EXISTS `supplier_ageing_analysis` (
  `id` int NOT NULL AUTO_INCREMENT,
  `age_code` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `ageing_group` enum('monthly','daily','custom') COLLATE utf8mb4_unicode_ci NOT NULL,
  `interval_type` enum('statement_date','invoice_date') COLLATE utf8mb4_unicode_ci NOT NULL,
  `interval_value` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `custom_age_groups` text COLLATE utf8mb4_unicode_ci,
  `custom_intervals` text COLLATE utf8mb4_unicode_ci,
  `actions` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `supplier_areas`
--

DROP TABLE IF EXISTS `supplier_areas`;
CREATE TABLE IF NOT EXISTS `supplier_areas` (
  `area_id` int NOT NULL AUTO_INCREMENT,
  `area_code` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `area_name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `city` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `country` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `specific_location` text COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`area_id`),
  UNIQUE KEY `area_code` (`area_code`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `supplier_areas`
--

INSERT INTO `supplier_areas` (`area_id`, `area_code`, `area_name`, `city`, `country`, `specific_location`, `created_at`) VALUES
(1, 'AC123', 'Downtown', 'London', 'UK', 'Warehouse 1', '2026-01-03 10:04:16');

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

--
-- Table structure for table `supplier_categories`
--

DROP TABLE IF EXISTS `supplier_categories`;
CREATE TABLE IF NOT EXISTS `supplier_categories` (
  `category_id` int NOT NULL AUTO_INCREMENT,
  `category_code` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `category_name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`category_id`),
  UNIQUE KEY `category_code` (`category_code`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `supplier_categories`
--

INSERT INTO `supplier_categories` (`category_id`, `category_code`, `category_name`, `description`, `created_at`, `updated_at`) VALUES
(1, 'SUPCT001', 'OFFICE SUPPLIES', 'STATIONERY', '2026-01-14 14:24:54', '2026-01-15 06:35:02');

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

--
-- Table structure for table `supplier_invoices`
--

DROP TABLE IF EXISTS `supplier_invoices`;
CREATE TABLE IF NOT EXISTS `supplier_invoices` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `supplier_id` bigint UNSIGNED NOT NULL,
  `invoice_number` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `invoice_date` date NOT NULL,
  `reference_number` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `contact_person` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `narration` text COLLATE utf8mb4_unicode_ci,
  `reference_det` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `gl_account` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `tax_id` bigint UNSIGNED NOT NULL,
  `discount` decimal(5,2) NOT NULL DEFAULT '0.00',
  `price` decimal(15,2) NOT NULL,
  `quantity` decimal(10,2) NOT NULL DEFAULT '1.00',
  `currency_id` bigint UNSIGNED NOT NULL,
  `operation_cost` decimal(15,2) NOT NULL DEFAULT '0.00',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `invoice_number` (`invoice_number`),
  KEY `idx_supplier_invoices_supplier_id` (`supplier_id`),
  KEY `idx_supplier_invoices_invoice_date` (`invoice_date`),
  KEY `idx_supplier_invoices_invoice_number` (`invoice_number`),
  KEY `idx_supplier_invoices_gl_account` (`gl_account`),
  KEY `idx_supplier_invoices_created_at` (`created_at`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `supplier_invoices`
--

INSERT INTO `supplier_invoices` (`id`, `supplier_id`, `invoice_number`, `invoice_date`, `reference_number`, `description`, `contact_person`, `narration`, `reference_det`, `gl_account`, `tax_id`, `discount`, `price`, `quantity`, `currency_id`, `operation_cost`, `created_at`, `updated_at`) VALUES
(4, 1, 'SUP-INV-20260327-001', '2026-03-07', 'ALPHA-INV-1001', 'Office stationery and printing supplies', 'John Moyo', 'Monthly office consumables restock.', 'Stationery batch Jan', '5100', 12, 0.00, 120.00, 3.00, 1, 0.00, '2026-03-27 06:19:47', '2026-03-27 06:19:47'),
(5, 2, 'SUP-INV-20260327-002', '2026-03-15', 'BETA-INV-2054', 'IT hardware and structured cabling', 'Sarah Dube', 'Replacement switches and cabling work.', 'IT refresh phase 1', '5100', 12, 5.00, 250.00, 2.00, 1, 25.00, '2026-03-27 06:19:47', '2026-03-27 06:19:47'),
(6, 3, 'SUP-INV-20260327-003', '2026-03-22', 'GAMMA-INV-0078', 'Facility maintenance and security upgrades', 'Tawanda Chirwa', 'Quarterly facility preventive maintenance.', 'Maintenance Q1', '5100', 12, 0.00, 180.00, 1.00, 1, 10.00, '2026-03-27 06:19:47', '2026-03-27 06:19:47');

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

--
-- Table structure for table `supplier_invoice_lines`
--

DROP TABLE IF EXISTS `supplier_invoice_lines`;
CREATE TABLE IF NOT EXISTS `supplier_invoice_lines` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `invoice_id` bigint UNSIGNED NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `gl_account_id` bigint UNSIGNED DEFAULT NULL,
  `tax_id` bigint UNSIGNED DEFAULT NULL,
  `discount_pct` decimal(5,2) NOT NULL DEFAULT '0.00',
  `unit_price` decimal(15,2) NOT NULL DEFAULT '0.00',
  `quantity` decimal(10,2) NOT NULL DEFAULT '1.00',
  `tax_rate` decimal(5,2) NOT NULL DEFAULT '0.00',
  `tax_amount` decimal(15,2) NOT NULL DEFAULT '0.00',
  `line_total` decimal(15,2) NOT NULL DEFAULT '0.00',
  `currency_id` bigint UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `supplier_invoice_lines_invoice_id_index` (`invoice_id`),
  KEY `supplier_invoice_lines_gl_account_id_index` (`gl_account_id`),
  KEY `supplier_invoice_lines_tax_id_index` (`tax_id`),
  KEY `supplier_invoice_lines_currency_id_index` (`currency_id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `supplier_invoice_lines`
--

INSERT INTO `supplier_invoice_lines` (`id`, `invoice_id`, `description`, `gl_account_id`, `tax_id`, `discount_pct`, `unit_price`, `quantity`, `tax_rate`, `tax_amount`, `line_total`, `currency_id`, `created_at`, `updated_at`) VALUES
(1, 4, 'Office stationery and printing supplies', NULL, 12, 0.00, 120.00, 3.00, 15.00, 54.00, 414.00, 1, '2026-03-27 06:19:47', '2026-03-27 06:19:47'),
(2, 5, 'IT hardware and structured cabling', NULL, 12, 5.00, 250.00, 2.00, 15.00, 71.25, 571.25, 1, '2026-03-27 06:19:47', '2026-03-27 06:19:47'),
(3, 6, 'Facility maintenance and security upgrades', NULL, 12, 0.00, 180.00, 1.00, 15.00, 27.00, 217.00, 1, '2026-03-27 06:19:47', '2026-03-27 06:19:47');

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

--
-- Table structure for table `supplier_journals`
--

DROP TABLE IF EXISTS `supplier_journals`;
CREATE TABLE IF NOT EXISTS `supplier_journals` (
  `id` int NOT NULL AUTO_INCREMENT,
  `date` date NOT NULL,
  `supplier_code` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `supplier_name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `narration` text COLLATE utf8mb4_unicode_ci,
  `dr` decimal(15,2) DEFAULT '0.00',
  `cr` decimal(15,2) DEFAULT '0.00',
  `status` enum('pending','approved','rejected','reversed') COLLATE utf8mb4_unicode_ci DEFAULT 'pending',
  `supplier_id` int DEFAULT NULL,
  `transaction_code` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `transaction_code` (`transaction_code`),
  KEY `idx_date` (`date`),
  KEY `idx_supplier_code` (`supplier_code`)
) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `supplier_journals`
--

INSERT INTO `supplier_journals` (`id`, `date`, `supplier_code`, `supplier_name`, `narration`, `dr`, `cr`, `status`, `supplier_id`, `transaction_code`, `created_at`, `updated_at`) VALUES
(1, '2026-01-02', 'SUP-001', 'Alpha Supplies', 'Office stationery and supplies - January', 320.00, 320.00, 'approved', 1, 'SJ-2026-0001', '2026-04-01 10:53:15', '2026-04-01 10:53:15'),
(2, '2026-01-05', 'SUP-002', 'Beta Traders', 'Monthly office rent payment - January 2026', 2800.00, 2800.00, 'approved', 2, 'SJ-2026-0002', '2026-04-01 10:53:15', '2026-04-01 10:53:15'),
(3, '2026-01-07', 'SUP-003', 'Gamma Industries', 'Electricity bill - January office consumption', 415.00, 415.00, 'approved', 3, 'SJ-2026-0003', '2026-04-01 10:53:15', '2026-04-01 10:53:15'),
(4, '2026-01-09', 'SUP-004', 'Delta Logistics', 'Courier and document delivery services - January', 190.00, 190.00, 'approved', 4, 'SJ-2026-0004', '2026-04-01 10:53:15', '2026-04-01 10:53:15'),
(5, '2026-01-12', 'SUP-005', 'Epsilon Holdings', 'Fibre internet and VOIP line - January subscription', 560.00, 560.00, 'approved', 5, 'SJ-2026-0005', '2026-04-01 10:53:15', '2026-04-01 10:53:15'),
(6, '2026-01-15', 'SUP-006', 'Zeta Chemicals', 'Office cleaning supplies and consumables', 145.00, 145.00, 'approved', 6, 'SJ-2026-0006', '2026-04-01 10:53:15', '2026-04-01 10:53:15'),
(7, '2026-01-19', 'SUP-007', 'Eta Engineering', 'IT support and equipment maintenance - January', 880.00, 880.00, 'approved', 7, 'SJ-2026-0007', '2026-04-01 10:53:15', '2026-04-01 10:53:15'),
(8, '2026-01-22', 'SUP-008', 'Theta Foods', 'Staff catering and boardroom refreshments', 230.00, 230.00, 'approved', 8, 'SJ-2026-0008', '2026-04-01 10:53:15', '2026-04-01 10:53:15'),
(9, '2026-01-26', 'SUP-009', 'Iota Technologies', 'Practice management software licence - annual renewal', 1200.00, 1200.00, 'approved', 9, 'SJ-2026-0009', '2026-04-01 10:53:15', '2026-04-01 10:53:15'),
(10, '2026-01-29', 'SUP-010', 'Kappa Medical', 'First aid and occupational health supplies - office compliance', 175.00, 175.00, 'approved', 10, 'SJ-2026-0010', '2026-04-01 10:53:15', '2026-04-01 10:53:15'),
(11, '2026-02-02', 'SUP-001', 'Alpha Supplies', 'Printer cartridges and paper stock - February', 290.00, 290.00, 'approved', 1, 'SJ-2026-0011', '2026-04-01 10:53:15', '2026-04-01 10:53:15'),
(12, '2026-02-05', 'SUP-002', 'Beta Traders', 'Monthly office rent payment - February 2026', 2800.00, 2800.00, 'approved', 2, 'SJ-2026-0012', '2026-04-01 10:53:15', '2026-04-01 10:53:15'),
(13, '2026-02-08', 'SUP-003', 'Gamma Industries', 'Water and sewerage bill - February', 185.00, 185.00, 'approved', 3, 'SJ-2026-0013', '2026-04-01 10:53:15', '2026-04-01 10:53:15'),
(14, '2026-02-11', 'SUP-004', 'Delta Logistics', 'Sheriff process serving and document delivery - February', 340.00, 340.00, 'approved', 4, 'SJ-2026-0014', '2026-04-01 10:53:15', '2026-04-01 10:53:15'),
(15, '2026-02-14', 'SUP-005', 'Epsilon Holdings', 'Backup LTE and mobile data - February', 210.00, 210.00, 'approved', 5, 'SJ-2026-0015', '2026-04-01 10:53:15', '2026-04-01 10:53:15'),
(16, '2026-02-18', 'SUP-006', 'Zeta Chemicals', 'Refuse removal and municipal rates - February', 320.00, 320.00, 'approved', 6, 'SJ-2026-0016', '2026-04-01 10:53:15', '2026-04-01 10:53:15'),
(17, '2026-02-21', 'SUP-007', 'Eta Engineering', 'Cloud backup storage and server maintenance', 650.00, 650.00, 'approved', 7, 'SJ-2026-0017', '2026-04-01 10:53:15', '2026-04-01 10:53:15'),
(18, '2026-02-25', 'SUP-008', 'Theta Foods', 'Boardroom hire for client consultations - February', 480.00, 480.00, 'approved', 8, 'SJ-2026-0018', '2026-04-01 10:53:15', '2026-04-01 10:53:15'),
(19, '2026-02-27', 'SUP-009', 'Iota Technologies', 'Legal research platform subscription - February', 390.00, 390.00, 'approved', 9, 'SJ-2026-0019', '2026-04-01 10:53:15', '2026-04-01 10:53:15'),
(20, '2026-03-03', 'SUP-010', 'Kappa Medical', 'Professional indemnity insurance premium - March instalment', 1450.00, 1450.00, 'approved', 10, 'SJ-2026-0020', '2026-04-01 10:53:15', '2026-04-01 10:53:15'),
(21, '2026-03-06', 'SUP-001', 'Alpha Supplies', 'Office stationery restock - March', 275.00, 275.00, 'approved', 1, 'SJ-2026-0021', '2026-04-01 10:53:15', '2026-04-01 10:53:15'),
(22, '2026-03-09', 'SUP-002', 'Beta Traders', 'Monthly office rent payment - March 2026', 2800.00, 2800.00, 'approved', 2, 'SJ-2026-0022', '2026-04-01 10:53:15', '2026-04-01 10:53:15'),
(23, '2026-03-14', 'SUP-003', 'Gamma Industries', 'Electricity bill - March and solar generator levy', 490.00, 490.00, 'approved', 3, 'SJ-2026-0023', '2026-04-01 10:53:15', '2026-04-01 10:53:15'),
(24, '2026-03-20', 'SUP-007', 'Eta Engineering', 'MS Office and productivity suite licences - annual renewal', 780.00, 780.00, 'approved', 7, 'SJ-2026-0024', '2026-04-01 10:53:15', '2026-04-01 10:53:15'),
(25, '2026-03-26', 'SUP-009', 'Iota Technologies', 'Law Society and Bar Council subscription - annual membership', 960.00, 960.00, 'approved', 9, 'SJ-2026-0025', '2026-04-01 10:53:15', '2026-04-01 10:53:15');

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

--
-- Table structure for table `system_settings`
--

DROP TABLE IF EXISTS `system_settings`;
CREATE TABLE IF NOT EXISTS `system_settings` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `default_currency_id` bigint UNSIGNED DEFAULT NULL,
  `default_language` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'en',
  `timezone` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'UTC',
  `date_format` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'Y-m-d',
  `number_format` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'en',
  `email_notifications` tinyint(1) NOT NULL DEFAULT '1',
  `auto_backup_frequency` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'weekly',
  `case_number_prefix` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'CASE',
  `invoice_number_prefix` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'INV',
  `quotation_number_prefix` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'QUO',
  `receipt_number_prefix` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'REC',
  `matter_number_prefix` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `matter_number_format` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `matter_number_padding` int UNSIGNED DEFAULT NULL,
  `default_case_status` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'Open',
  `default_payment_terms` int NOT NULL DEFAULT '30',
  `tax_calculation_method` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'exclusive',
  `file_upload_size_limit` int NOT NULL DEFAULT '10',
  `session_timeout` int NOT NULL DEFAULT '60',
  `maintenance_mode` tinyint(1) NOT NULL DEFAULT '0',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_system_settings_currency` (`default_currency_id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `system_settings`
--

INSERT INTO `system_settings` (`id`, `default_currency_id`, `default_language`, `timezone`, `date_format`, `number_format`, `email_notifications`, `auto_backup_frequency`, `case_number_prefix`, `invoice_number_prefix`, `quotation_number_prefix`, `receipt_number_prefix`, `matter_number_prefix`, `matter_number_format`, `matter_number_padding`, `default_case_status`, `default_payment_terms`, `tax_calculation_method`, `file_upload_size_limit`, `session_timeout`, `maintenance_mode`, `created_at`, `updated_at`) VALUES
(1, NULL, 'en', 'UTC', 'Y-m-d', 'en', 1, 'weekly', 'CASE', 'INV', 'QUO', 'REC', NULL, NULL, NULL, 'Open', 30, 'exclusive', 10, 60, 0, NULL, NULL);

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

--
-- Table structure for table `tariffs`
--

DROP TABLE IF EXISTS `tariffs`;
CREATE TABLE IF NOT EXISTS `tariffs` (
  `tariff_id` int NOT NULL AUTO_INCREMENT,
  `lawyer_id` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'FK → lawyers.lawyer_id',
  `tier_id` int DEFAULT NULL COMMENT 'FK → user_tiers.tier_id',
  `group_id` int DEFAULT NULL COMMENT 'FK → lawyer_groups.group_id',
  `service_code` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Unique short code e.g. CIV-DRAFT-JR. Used by application to fetch the correct tariff.',
  `service_name` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
  `service_category` enum('legal_advice','drafting','court_appearance','research','correspondence','filing','consultation','negotiation','conveyancing','other') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'other',
  `billing_method` enum('FIXED_FEE','HOURLY','PER_APPEARANCE','PER_STAGE','RETAINER_PLUS','CONTINGENCY','SUBSCRIPTION') COLLATE utf8mb4_unicode_ci NOT NULL,
  `rate_type` enum('PER_HOUR','PER_CASE','PER_DOCUMENT','PER_APPEARANCE','PER_CONSULTATION','PER_MONTH','PERCENTAGE') COLLATE utf8mb4_unicode_ci NOT NULL,
  `rate_amount` decimal(12,2) NOT NULL COMMENT 'Hourly rate (HOURLY) or flat fee (FIXED_FEE)',
  `currency_id` bigint UNSIGNED NOT NULL DEFAULT '1' COMMENT 'FK → currencies.currency_id',
  `billing_increment` int NOT NULL DEFAULT '60' COMMENT 'Rounding unit in minutes: 6, 15, 30, or 60',
  `minimum_billable_mins` int NOT NULL DEFAULT '6' COMMENT 'Smallest unit that can be charged',
  `minimum_fee` decimal(12,2) DEFAULT NULL,
  `maximum_fee` decimal(12,2) DEFAULT NULL,
  `retainer_required` tinyint(1) NOT NULL DEFAULT '0',
  `retainer_amount` decimal(12,2) DEFAULT NULL,
  `court_level` enum('MAGISTRATES','HIGH_COURT','SUPREME_COURT','CONSTITUTIONAL_COURT') COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `complexity_level` enum('LOW','MEDIUM','HIGH') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'MEDIUM',
  `tax_inclusive` tinyint(1) NOT NULL DEFAULT '0',
  `vat_rate` decimal(5,2) NOT NULL DEFAULT '0.00',
  `effective_from` date NOT NULL,
  `effective_to` date DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `deleted_at` timestamp NULL DEFAULT NULL COMMENT 'Soft-delete only. Hard-delete breaks invoice history.',
  `description` text COLLATE utf8mb4_unicode_ci,
  `notes` text COLLATE utf8mb4_unicode_ci,
  `created_by` bigint UNSIGNED DEFAULT NULL,
  `updated_by` bigint UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`tariff_id`),
  UNIQUE KEY `uq_service_code` (`service_code`),
  KEY `idx_tariff_lawyer` (`lawyer_id`),
  KEY `idx_tariff_tier` (`tier_id`),
  KEY `idx_tariff_group` (`group_id`),
  KEY `idx_tariff_method` (`billing_method`),
  KEY `idx_tariff_active` (`is_active`,`effective_from`,`effective_to`)
) ;

--
-- Dumping data for table `tariffs`
--

INSERT INTO `tariffs` (`tariff_id`, `lawyer_id`, `tier_id`, `group_id`, `service_code`, `service_name`, `service_category`, `billing_method`, `rate_type`, `rate_amount`, `currency_id`, `billing_increment`, `minimum_billable_mins`, `minimum_fee`, `maximum_fee`, `retainer_required`, `retainer_amount`, `court_level`, `complexity_level`, `tax_inclusive`, `vat_rate`, `effective_from`, `effective_to`, `is_active`, `deleted_at`, `description`, `notes`, `created_by`, `updated_by`, `created_at`, `updated_at`) VALUES
(1, '1', 1, 1, 'CIV-DRAFT-HR', 'Contract Drafting – Hourly', 'drafting', 'HOURLY', 'PER_HOUR', 75.00, 1, 15, 6, 37.50, NULL, 0, NULL, NULL, 'MEDIUM', 0, 15.00, '2026-01-01', NULL, 1, NULL, 'Hourly rate for commercial contract drafting and review.', NULL, 1, 1, '2026-03-27 05:55:21', '2026-03-27 05:55:21'),
(2, '1', 1, 1, 'CIV-DRAFT-FIXED', 'Contract Drafting – Fixed Fee', 'drafting', 'FIXED_FEE', 'PER_CASE', 300.00, 1, 0, 0, 300.00, 300.00, 0, NULL, NULL, 'LOW', 0, 15.00, '2026-01-01', NULL, 1, NULL, 'Fixed fee for standard NDA or simple commercial agreement.', NULL, 1, 1, '2026-03-27 05:55:21', '2026-03-27 05:55:21'),
(3, '1', 1, 1, 'CIV-RESEARCH-HR', 'Legal Research – Hourly', 'research', 'HOURLY', 'PER_HOUR', 60.00, 1, 15, 6, 30.00, NULL, 0, NULL, NULL, 'LOW', 0, 15.00, '2026-01-01', NULL, 1, NULL, 'Case law research, statute review and memoranda.', NULL, 1, 1, '2026-03-27 05:55:21', '2026-03-27 05:55:21'),
(4, '1', 1, 1, 'CIV-CONSULT-HR', 'Civil Law Consultation – Hourly', 'consultation', 'HOURLY', 'PER_HOUR', 80.00, 1, 30, 30, 40.00, NULL, 0, NULL, NULL, 'MEDIUM', 0, 15.00, '2026-01-01', NULL, 1, NULL, 'Client consultation on civil matters.', NULL, 1, 1, '2026-03-27 05:55:21', '2026-03-27 05:55:21'),
(5, '2', 2, 3, 'FAM-DIV-FIXED', 'Divorce Proceedings – Full Service', 'filing', 'FIXED_FEE', 'PER_CASE', 1200.00, 1, 0, 0, 1200.00, 1200.00, 1, 300.00, 'HIGH_COURT', 'HIGH', 0, 15.00, '2026-01-01', NULL, 1, NULL, 'Uncontested divorce including summons, pleadings, settlement agreement and up to 3 court appearances.', NULL, 1, 1, '2026-03-27 05:55:21', '2026-03-27 05:55:21'),
(6, '2', 2, 3, 'FAM-CUSTODY-FIXED', 'Child Custody Application – Fixed', 'filing', 'FIXED_FEE', 'PER_CASE', 800.00, 1, 0, 0, 800.00, 800.00, 1, 200.00, 'HIGH_COURT', 'HIGH', 0, 15.00, '2026-01-01', NULL, 1, NULL, 'Application for custody order including all pleadings and one court appearance.', NULL, 1, 1, '2026-03-27 05:55:21', '2026-03-27 05:55:21'),
(7, '2', 2, 3, 'FAM-CONSULT-HR', 'Family Law Consultation – Hourly', 'consultation', 'HOURLY', 'PER_HOUR', 90.00, 1, 30, 30, 45.00, NULL, 0, NULL, NULL, 'MEDIUM', 0, 15.00, '2026-01-01', NULL, 1, NULL, 'Hourly consultation on divorce, custody and maintenance matters.', NULL, 1, 1, '2026-03-27 05:55:21', '2026-03-27 05:55:21'),
(8, '2', 2, 3, 'FAM-MAINT-FIXED', 'Maintenance Application – Fixed', 'filing', 'FIXED_FEE', 'PER_CASE', 500.00, 1, 0, 0, 500.00, 500.00, 0, NULL, 'MAGISTRATES', 'MEDIUM', 0, 15.00, '2026-01-01', NULL, 1, NULL, 'Maintenance application in Magistrates Court.', NULL, 1, 1, '2026-03-27 05:55:21', '2026-03-27 05:55:21'),
(9, '3', 3, 2, 'CRIM-APPEAR-MAG', 'Criminal Appearance – Magistrates', 'court_appearance', 'FIXED_FEE', 'PER_APPEARANCE', 150.00, 1, 0, 0, 150.00, 150.00, 0, NULL, 'MAGISTRATES', 'HIGH', 0, 0.00, '2026-01-01', NULL, 1, NULL, 'Single appearance in Magistrates Court for criminal matters.', NULL, 1, 1, '2026-03-27 05:55:21', '2026-03-27 05:55:21'),
(10, '3', 3, 2, 'CRIM-APPEAR-HC', 'Criminal Appearance – High Court', 'court_appearance', 'FIXED_FEE', 'PER_APPEARANCE', 350.00, 1, 0, 0, 350.00, 350.00, 0, NULL, 'HIGH_COURT', 'HIGH', 0, 0.00, '2026-01-01', NULL, 1, NULL, 'Single appearance in High Court for criminal matters.', NULL, 1, 1, '2026-03-27 05:55:21', '2026-03-27 05:55:21'),
(11, '3', 3, 2, 'CRIM-BRIEF-HR', 'Criminal Defence Brief – Hourly', 'legal_advice', 'HOURLY', 'PER_HOUR', 140.00, 1, 15, 6, 70.00, 2800.00, 1, 700.00, 'HIGH_COURT', 'HIGH', 0, 0.00, '2026-01-01', NULL, 1, NULL, 'Full criminal defence at senior associate hourly rate. Covers briefings, preparation and court time.', NULL, 1, 1, '2026-03-27 05:55:21', '2026-03-27 05:55:21'),
(12, '3', 3, 2, 'CRIM-BAIL-FIXED', 'Bail Application – Fixed Fee', 'filing', 'FIXED_FEE', 'PER_CASE', 400.00, 1, 0, 0, 400.00, 400.00, 0, NULL, 'MAGISTRATES', 'HIGH', 0, 0.00, '2026-01-01', NULL, 1, NULL, 'Urgent bail application including supporting affidavits.', NULL, 1, 1, '2026-03-27 05:55:21', '2026-03-27 05:55:21'),
(13, 'L200861', NULL, 12, 'MIN-COMPLIANCE-HR', 'Mining Compliance Advisory – Hourly', 'legal_advice', 'HOURLY', 'PER_HOUR', 120.00, 1, 15, 6, 60.00, NULL, 0, NULL, NULL, 'HIGH', 0, 15.00, '2026-01-01', NULL, 1, NULL, 'Regulatory compliance on mining rights, ZEMA and EIA matters.', NULL, 1, 1, '2026-03-27 05:55:21', '2026-03-27 05:55:21'),
(14, 'L200861', NULL, 12, 'MIN-PERMIT-FIXED', 'Mining Permit Application – Fixed', 'filing', 'FIXED_FEE', 'PER_CASE', 950.00, 1, 0, 0, 950.00, 950.00, 1, 250.00, NULL, 'HIGH', 0, 15.00, '2026-01-01', NULL, 1, NULL, 'End-to-end mining permit: drafting, lodgement and follow-up.', NULL, 1, 1, '2026-03-27 05:55:21', '2026-03-27 05:55:21'),
(15, 'L200861', NULL, 12, 'MIN-DISPUTE-HR', 'Mining Dispute Representation – Hourly', 'negotiation', 'HOURLY', 'PER_HOUR', 130.00, 1, 15, 6, 65.00, 3900.00, 1, 500.00, 'HIGH_COURT', 'HIGH', 0, 15.00, '2026-01-01', NULL, 1, NULL, 'Representation in mining boundary and licence disputes.', NULL, 1, 1, '2026-03-27 05:55:21', '2026-03-27 05:55:21'),
(16, 'L940147', NULL, 14, 'TAX-ADVISORY-HR', 'Tax Advisory – Hourly', 'legal_advice', 'HOURLY', 'PER_HOUR', 110.00, 1, 15, 6, 55.00, NULL, 0, NULL, NULL, 'MEDIUM', 0, 15.00, '2026-01-01', NULL, 1, NULL, 'Advice on corporate tax, ZIMRA assessments, VAT and transfer pricing.', NULL, 1, 1, '2026-03-27 05:55:21', '2026-03-27 05:55:21'),
(17, 'L940147', NULL, 14, 'TAX-OBJECTION-FIXED', 'ZIMRA Objection – Fixed Fee', 'filing', 'FIXED_FEE', 'PER_CASE', 600.00, 1, 0, 0, 600.00, 1800.00, 0, NULL, NULL, 'HIGH', 0, 15.00, '2026-01-01', NULL, 1, NULL, 'Preparation and lodgement of formal ZIMRA objection.', NULL, 1, 1, '2026-03-27 05:55:21', '2026-03-27 05:55:21'),
(18, 'L940147', NULL, 14, 'TAX-AUDIT-HR', 'Tax Audit Representation – Hourly', 'legal_advice', 'HOURLY', 'PER_HOUR', 125.00, 1, 15, 6, 62.50, 2500.00, 1, 400.00, NULL, 'HIGH', 0, 15.00, '2026-01-01', NULL, 1, NULL, 'Client representation during ZIMRA desk or field audit.', NULL, 1, 1, '2026-03-27 05:55:21', '2026-03-27 05:55:21');

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

--
-- Table structure for table `tariff_time_logs`
--

DROP TABLE IF EXISTS `tariff_time_logs`;
CREATE TABLE IF NOT EXISTS `tariff_time_logs` (
  `log_id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `lawyer_id` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'FK → lawyers.lawyer_id',
  `matter_id` bigint UNSIGNED DEFAULT NULL COMMENT 'FK → matters.id',
  `case_id` bigint UNSIGNED DEFAULT NULL COMMENT 'FK → cases.id',
  `client_id` bigint UNSIGNED DEFAULT NULL COMMENT 'FK → clients.id',
  `tariff_id` int DEFAULT NULL COMMENT 'FK → tariffs (NULL = ad-hoc rate)',
  `rate_snapshot` decimal(12,2) NOT NULL COMMENT 'IMMUTABLE. Rate copied from tariffs.rate_amount at log creation. Changing the tariff later does not affect this.',
  `currency_id` bigint UNSIGNED DEFAULT NULL,
  `work_date` date NOT NULL,
  `start_time` time DEFAULT NULL,
  `end_time` time DEFAULT NULL,
  `raw_minutes` int NOT NULL COMMENT 'Actual minutes — computed from start/end or entered manually',
  `rounded_minutes` int NOT NULL COMMENT 'raw_minutes rounded UP to the tariff billing_increment',
  `hours_decimal` decimal(8,4) GENERATED ALWAYS AS (round((`rounded_minutes` / 60.0),4)) STORED COMMENT 'Computed column: rounded_minutes ÷ 60',
  `task_type` enum('document_review','client_meeting','court_appearance','research','filing','correspondence','drafting','negotiation','phone_call','travel','administrative','other') COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `internal_notes` text COLLATE utf8mb4_unicode_ci COMMENT 'Never shown to client',
  `is_billable` tinyint(1) NOT NULL DEFAULT '1',
  `is_billed` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Set 1 when pulled onto a posted invoice line',
  `invoice_line_id` bigint UNSIGNED DEFAULT NULL COMMENT 'Set when billed — FK → client_invoice_lines.id',
  `amount` decimal(12,2) GENERATED ALWAYS AS (round((`rate_snapshot` * round((`rounded_minutes` / 60.0),4)),2)) STORED COMMENT 'Computed, immutable earnings for this time block',
  `status` enum('draft','submitted','approved','billed','written_off','rejected') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'draft',
  `write_off_reason` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `approved_by` bigint UNSIGNED DEFAULT NULL,
  `approved_at` timestamp NULL DEFAULT NULL,
  `created_by` bigint UNSIGNED DEFAULT NULL,
  `updated_by` bigint UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`log_id`),
  KEY `idx_ttl_lawyer` (`lawyer_id`),
  KEY `idx_ttl_matter` (`matter_id`),
  KEY `idx_ttl_case` (`case_id`),
  KEY `idx_ttl_client` (`client_id`),
  KEY `idx_ttl_tariff` (`tariff_id`),
  KEY `idx_ttl_work_date` (`work_date`),
  KEY `idx_ttl_status` (`status`),
  KEY `idx_ttl_is_billed` (`is_billed`),
  KEY `idx_ttl_invoice_line` (`invoice_line_id`)
) ;

--
-- Dumping data for table `tariff_time_logs`
--

INSERT INTO `tariff_time_logs` (`log_id`, `lawyer_id`, `matter_id`, `case_id`, `client_id`, `tariff_id`, `rate_snapshot`, `currency_id`, `work_date`, `start_time`, `end_time`, `raw_minutes`, `rounded_minutes`, `task_type`, `description`, `internal_notes`, `is_billable`, `is_billed`, `invoice_line_id`, `status`, `write_off_reason`, `approved_by`, `approved_at`, `created_by`, `updated_by`, `created_at`, `updated_at`) VALUES
(1, '1', 101, NULL, 1, 1, 75.00, 1, '2026-01-06', NULL, NULL, 70, 75, 'drafting', 'Drafted NDA agreement', NULL, 1, 1, 1, 'billed', NULL, NULL, NULL, NULL, NULL, '2026-03-27 06:13:39', '2026-03-27 06:18:14'),
(2, '1', 101, NULL, 1, 1, 75.00, 1, '2026-01-07', NULL, NULL, 60, 60, 'research', 'Reviewed clauses', NULL, 1, 1, 1, 'billed', NULL, NULL, NULL, NULL, NULL, '2026-03-27 06:13:39', '2026-03-27 06:18:14'),
(3, '1', 101, NULL, 1, 1, 75.00, 1, '2026-01-08', NULL, NULL, 90, 90, '', 'Client strategy meeting', NULL, 1, 1, 1, 'billed', NULL, NULL, NULL, NULL, NULL, '2026-03-27 06:13:39', '2026-03-27 06:18:14'),
(4, '1', 101, NULL, 1, 1, 75.00, 1, '2026-01-12', NULL, NULL, 30, 30, 'correspondence', 'Email follow-up', NULL, 1, 0, NULL, 'approved', NULL, NULL, NULL, NULL, NULL, '2026-03-27 06:13:39', '2026-03-27 06:13:39');

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

--
-- Table structure for table `taxes`
--

DROP TABLE IF EXISTS `taxes`;
CREATE TABLE IF NOT EXISTS `taxes` (
  `tax_id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `tax_name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `tax_description` text COLLATE utf8mb4_unicode_ci,
  `tax_rate` decimal(5,2) NOT NULL,
  `tax_type` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `is_active` tinyint(1) DEFAULT NULL,
  PRIMARY KEY (`tax_id`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `taxes`
--

INSERT INTO `taxes` (`tax_id`, `tax_name`, `tax_description`, `tax_rate`, `tax_type`, `created_at`, `updated_at`, `is_active`) VALUES
(1, 'AIDS LEVY', NULL, 3.00, 'STATE AID', '2026-01-03 08:00:49', '2026-01-07 09:43:13', 1),
(2, 'VAT – Professional Legal Services', 'Value Added Tax charged on professional legal services as per ZIMRA regulations', 15.00, 'VAT', '2026-01-07 09:41:41', '2026-01-07 09:41:41', 1),
(3, 'Withholding Tax – Legal Fees', 'Statutory withholding tax deducted on legal fees payable to practitioners', 10.00, 'WITHHOLDING', '2026-01-07 09:41:41', '2026-01-07 09:41:41', 1),
(4, 'Capital Gains Tax – Property Transfers', 'Capital gains tax applicable on conveyancing and property transfer transactions', 20.00, 'CAPITAL_GAINS', '2026-01-07 09:41:41', '2026-01-07 09:41:41', 1),
(5, 'Stamp Duty – Property Transfer', 'Stamp duty payable on transfer of immovable property', 4.00, 'DUTY', '2026-01-07 09:41:41', '2026-01-07 09:41:41', 1),
(6, 'Stamp Duty – Share Transfer', 'Stamp duty payable on transfer of shares', 2.00, 'DUTY', '2026-01-07 09:41:41', '2026-01-07 09:41:41', 1),
(7, 'Withholding Tax – Consultancy Services', 'Withholding tax on consultancy and advisory services related to legal work', 10.00, 'WITHHOLDING', '2026-01-07 09:41:41', '2026-01-07 09:41:41', 1),
(8, 'Presumptive Tax – Professional Services', 'Presumptive tax applicable to professional service providers where applicable', 5.00, 'PRESUMPTIVE', '2026-01-07 09:41:41', '2026-01-07 09:41:41', 1),
(9, 'VAT – Disbursements Recoverable', 'VAT charged on recoverable disbursements billed to clients', 15.00, 'VAT', '2026-01-07 09:41:41', '2026-01-07 09:41:41', 1),
(10, 'Court Levy', 'Statutory court levy payable on filing of court documents and processes', 2.00, 'LEVY', '2026-01-07 09:41:41', '2026-01-07 09:41:41', 1),
(11, 'Transfer Duty – Deeds Registry', 'Government transfer duty payable at the Deeds Registry during conveyancing', 3.00, 'DUTY', '2026-01-07 09:41:41', '2026-01-07 09:41:41', 1),
(12, 'VAT', 'Value Added Tax', 15.00, 'VAT', '2026-01-07 08:02:37', '2026-01-07 08:02:37', 1),
(13, 'Sales Tax', 'Sales Tax', 10.00, 'Sales Tax', '2026-01-07 08:02:37', '2026-01-07 08:02:37', 1),
(14, 'Service Tax', 'Service Tax', 12.00, 'Service Tax', '2026-01-07 08:02:37', '2026-01-07 08:02:37', 1),
(15, 'Excise Duty', 'Excise Duty', 20.00, 'Excise Duty', '2026-01-07 08:02:37', '2026-01-07 08:02:37', 1),
(16, 'No Tax', 'No Tax Applicable', 0.00, 'None', '2026-01-07 08:02:37', '2026-01-07 08:02:37', 1);

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

--
-- Table structure for table `tier_permissions`
--

DROP TABLE IF EXISTS `tier_permissions`;
CREATE TABLE IF NOT EXISTS `tier_permissions` (
  `tier_permission_id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `tier_id` bigint UNSIGNED NOT NULL,
  `feature_id` bigint UNSIGNED NOT NULL,
  `can_view` tinyint(1) NOT NULL DEFAULT '0',
  `can_add` tinyint(1) NOT NULL DEFAULT '0',
  `can_edit` tinyint(1) NOT NULL DEFAULT '0',
  `can_delete` tinyint(1) NOT NULL DEFAULT '0',
  `can_export` tinyint(1) NOT NULL DEFAULT '0',
  `can_print` tinyint(1) NOT NULL DEFAULT '0',
  `can_approve` tinyint(1) NOT NULL DEFAULT '0',
  `created_by` bigint UNSIGNED NOT NULL,
  `updated_by` bigint UNSIGNED DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`tier_permission_id`),
  UNIQUE KEY `uq_tier_feature` (`tier_id`,`feature_id`),
  KEY `fk_tier_perm_feature` (`feature_id`),
  KEY `fk_tier_perm_created_by` (`created_by`),
  KEY `fk_tier_perm_updated_by` (`updated_by`)
) ENGINE=InnoDB AUTO_INCREMENT=415 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `tier_permissions`
--

INSERT INTO `tier_permissions` (`tier_permission_id`, `tier_id`, `feature_id`, `can_view`, `can_add`, `can_edit`, `can_delete`, `can_export`, `can_print`, `can_approve`, `created_by`, `updated_by`, `created_at`, `updated_at`) VALUES
(1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(2, 1, 46, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(3, 1, 17, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(4, 1, 35, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(5, 1, 26, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(6, 1, 11, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(7, 1, 22, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(8, 1, 24, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(9, 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(10, 1, 39, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(11, 1, 42, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(12, 1, 41, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(13, 1, 40, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(14, 1, 20, 1, 1, 1, 0, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(15, 1, 25, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(16, 1, 9, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(17, 1, 12, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(18, 1, 19, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(19, 1, 27, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(20, 1, 13, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(21, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(22, 1, 18, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(23, 1, 31, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(24, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(25, 1, 38, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(26, 1, 34, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(27, 1, 23, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(28, 1, 37, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(29, 1, 15, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(30, 1, 14, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(31, 1, 28, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(32, 1, 10, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(33, 1, 43, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(34, 1, 6, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(35, 1, 32, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(36, 1, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(37, 1, 21, 1, 1, 1, 0, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(38, 1, 29, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(39, 1, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(40, 1, 45, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(41, 1, 16, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(42, 1, 30, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(43, 1, 7, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(44, 1, 33, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(45, 1, 36, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(46, 1, 44, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(47, 2, 2, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(48, 2, 46, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(49, 2, 17, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(50, 2, 35, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(51, 2, 26, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(52, 2, 11, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(53, 2, 22, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(54, 2, 24, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(55, 2, 4, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(56, 2, 39, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(57, 2, 42, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(58, 2, 41, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(59, 2, 40, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(60, 2, 20, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(61, 2, 25, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(62, 2, 9, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(63, 2, 12, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(64, 2, 19, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(65, 2, 27, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(66, 2, 13, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(67, 2, 3, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(68, 2, 18, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(69, 2, 31, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(70, 2, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(71, 2, 38, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(72, 2, 34, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(73, 2, 23, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(74, 2, 37, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(75, 2, 15, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(76, 2, 14, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(77, 2, 28, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(78, 2, 10, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(79, 2, 43, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(80, 2, 6, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(81, 2, 32, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(82, 2, 5, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(83, 2, 21, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(84, 2, 29, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(85, 2, 8, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(86, 2, 45, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(87, 2, 16, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(88, 2, 30, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(89, 2, 7, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(90, 2, 33, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(91, 2, 36, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(92, 2, 44, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(93, 3, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(94, 3, 46, 1, 1, 1, 0, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(95, 3, 17, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(96, 3, 35, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(97, 3, 26, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(98, 3, 11, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(99, 3, 22, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(100, 3, 24, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(101, 3, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(102, 3, 39, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(103, 3, 42, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(104, 3, 41, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(105, 3, 40, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(106, 3, 20, 1, 1, 1, 0, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(107, 3, 25, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(108, 3, 9, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(109, 3, 12, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:48', '2026-02-26 11:55:48'),
(110, 3, 19, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(111, 3, 27, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(112, 3, 13, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(113, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(114, 3, 18, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(115, 3, 31, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(116, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(117, 3, 38, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(118, 3, 34, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(119, 3, 23, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(120, 3, 37, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(121, 3, 15, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(122, 3, 14, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(123, 3, 28, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(124, 3, 10, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(125, 3, 43, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(126, 3, 6, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(127, 3, 32, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(128, 3, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(129, 3, 21, 1, 1, 1, 0, 1, 1, 1, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(130, 3, 29, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(131, 3, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(132, 3, 45, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(133, 3, 16, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(134, 3, 30, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(135, 3, 7, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(136, 3, 33, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(137, 3, 36, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(138, 3, 44, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(139, 4, 2, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(140, 4, 46, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(141, 4, 17, 1, 1, 1, 1, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(142, 4, 35, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(143, 4, 26, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(144, 4, 11, 1, 1, 1, 1, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(145, 4, 22, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(146, 4, 24, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(147, 4, 4, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(148, 4, 39, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(149, 4, 42, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(150, 4, 41, 1, 1, 1, 1, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(151, 4, 40, 1, 1, 1, 1, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(152, 4, 20, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(153, 4, 25, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(154, 4, 9, 1, 1, 1, 1, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(155, 4, 12, 1, 1, 1, 1, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(156, 4, 19, 1, 1, 1, 1, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(157, 4, 27, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(158, 4, 13, 1, 1, 1, 1, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(159, 4, 3, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(160, 4, 18, 1, 1, 1, 1, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(161, 4, 31, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(162, 4, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(163, 4, 38, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(164, 4, 34, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(165, 4, 23, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(166, 4, 37, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(167, 4, 15, 1, 1, 1, 1, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(168, 4, 14, 1, 1, 1, 1, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(169, 4, 28, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(170, 4, 10, 1, 1, 1, 1, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(171, 4, 43, 1, 1, 1, 1, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(172, 4, 6, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(173, 4, 32, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(174, 4, 5, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(175, 4, 21, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(176, 4, 29, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(177, 4, 8, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(178, 4, 45, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(179, 4, 16, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(180, 4, 30, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(181, 4, 7, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(182, 4, 33, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(183, 4, 36, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(184, 4, 44, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(185, 5, 2, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(186, 5, 46, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(187, 5, 17, 1, 1, 1, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(188, 5, 35, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(189, 5, 26, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(190, 5, 11, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(191, 5, 22, 1, 1, 1, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(192, 5, 24, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(193, 5, 4, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(194, 5, 39, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(195, 5, 42, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(196, 5, 41, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(197, 5, 40, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(198, 5, 20, 1, 1, 1, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(199, 5, 25, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(200, 5, 9, 1, 1, 1, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(201, 5, 12, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(202, 5, 19, 1, 1, 1, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(203, 5, 27, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(204, 5, 13, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(205, 5, 3, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(206, 5, 18, 1, 1, 1, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(207, 5, 31, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(208, 5, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(209, 5, 38, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(210, 5, 34, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(211, 5, 23, 1, 1, 1, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(212, 5, 37, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(213, 5, 15, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(214, 5, 14, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(215, 5, 28, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(216, 5, 10, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(217, 5, 43, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(218, 5, 6, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(219, 5, 32, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(220, 5, 5, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(221, 5, 21, 1, 1, 1, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(222, 5, 29, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(223, 5, 8, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(224, 5, 45, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(225, 5, 16, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(226, 5, 30, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(227, 5, 7, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(228, 5, 33, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(229, 5, 36, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(230, 5, 44, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(231, 6, 2, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(232, 6, 46, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(233, 6, 17, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(234, 6, 35, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(235, 6, 26, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(236, 6, 11, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(237, 6, 22, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(238, 6, 24, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(239, 6, 4, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(240, 6, 39, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(241, 6, 42, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(242, 6, 41, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(243, 6, 40, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(244, 6, 20, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(245, 6, 25, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(246, 6, 9, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(247, 6, 12, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(248, 6, 19, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(249, 6, 27, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(250, 6, 13, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(251, 6, 3, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(252, 6, 18, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(253, 6, 31, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(254, 6, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(255, 6, 38, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(256, 6, 34, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(257, 6, 23, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(258, 6, 37, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(259, 6, 15, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(260, 6, 14, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(261, 6, 28, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(262, 6, 10, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(263, 6, 43, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(264, 6, 6, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(265, 6, 32, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(266, 6, 5, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(267, 6, 21, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(268, 6, 29, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(269, 6, 8, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(270, 6, 45, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(271, 6, 16, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(272, 6, 30, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(273, 6, 7, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(274, 6, 33, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(275, 6, 36, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(276, 6, 44, 1, 0, 0, 0, 1, 1, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(277, 7, 2, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(278, 7, 46, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(279, 7, 17, 1, 1, 1, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(280, 7, 35, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(281, 7, 26, 1, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(282, 7, 11, 1, 1, 1, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(283, 7, 22, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(284, 7, 24, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(285, 7, 4, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(286, 7, 39, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(287, 7, 42, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(288, 7, 41, 1, 1, 1, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(289, 7, 40, 1, 1, 1, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(290, 7, 20, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(291, 7, 25, 1, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(292, 7, 9, 1, 1, 1, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(293, 7, 12, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(294, 7, 19, 1, 1, 1, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(295, 7, 27, 1, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(296, 7, 13, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(297, 7, 3, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(298, 7, 18, 1, 1, 1, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(299, 7, 31, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(300, 7, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(301, 7, 38, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(302, 7, 34, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(303, 7, 23, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(304, 7, 37, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(305, 7, 15, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(306, 7, 14, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(307, 7, 28, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(308, 7, 10, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(309, 7, 43, 1, 1, 1, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(310, 7, 6, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(311, 7, 32, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(312, 7, 5, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(313, 7, 21, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(314, 7, 29, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(315, 7, 8, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(316, 7, 45, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(317, 7, 16, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(318, 7, 30, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(319, 7, 7, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(320, 7, 33, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(321, 7, 36, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(322, 7, 44, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(323, 8, 2, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(324, 8, 46, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(325, 8, 17, 1, 1, 1, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(326, 8, 35, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(327, 8, 26, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(328, 8, 11, 1, 1, 1, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(329, 8, 22, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(330, 8, 24, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(331, 8, 4, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(332, 8, 39, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(333, 8, 42, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(334, 8, 41, 1, 1, 1, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(335, 8, 40, 1, 1, 1, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(336, 8, 20, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(337, 8, 25, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(338, 8, 9, 1, 1, 1, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(339, 8, 12, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(340, 8, 19, 1, 1, 1, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(341, 8, 27, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(342, 8, 13, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(343, 8, 3, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(344, 8, 18, 1, 1, 1, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(345, 8, 31, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(346, 8, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(347, 8, 38, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(348, 8, 34, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(349, 8, 23, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(350, 8, 37, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(351, 8, 15, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(352, 8, 14, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(353, 8, 28, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(354, 8, 10, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(355, 8, 43, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(356, 8, 6, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(357, 8, 32, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:49', '2026-02-26 11:55:49'),
(358, 8, 5, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(359, 8, 21, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(360, 8, 29, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(361, 8, 8, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(362, 8, 45, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(363, 8, 16, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(364, 8, 30, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(365, 8, 7, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(366, 8, 33, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(367, 8, 36, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(368, 8, 44, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(369, 9, 2, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(370, 9, 46, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(371, 9, 17, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(372, 9, 35, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(373, 9, 26, 1, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(374, 9, 11, 1, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(375, 9, 22, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(376, 9, 24, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(377, 9, 4, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(378, 9, 39, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(379, 9, 42, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(380, 9, 41, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(381, 9, 40, 1, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(382, 9, 20, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(383, 9, 25, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(384, 9, 9, 1, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(385, 9, 12, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(386, 9, 19, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(387, 9, 27, 1, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(388, 9, 13, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(389, 9, 3, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(390, 9, 18, 1, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(391, 9, 31, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(392, 9, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(393, 9, 38, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(394, 9, 34, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(395, 9, 23, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(396, 9, 37, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(397, 9, 15, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(398, 9, 14, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(399, 9, 28, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(400, 9, 10, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(401, 9, 43, 1, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(402, 9, 6, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(403, 9, 32, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(404, 9, 5, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(405, 9, 21, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(406, 9, 29, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(407, 9, 8, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(408, 9, 45, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(409, 9, 16, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(410, 9, 30, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(411, 9, 7, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(412, 9, 33, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(413, 9, 36, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50'),
(414, 9, 44, 0, 0, 0, 0, 0, 0, 0, 1, 1, '2026-02-26 11:55:50', '2026-02-26 11:55:50');

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

--
-- Table structure for table `transactions`
--

DROP TABLE IF EXISTS `transactions`;
CREATE TABLE IF NOT EXISTS `transactions` (
  `transaction_id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `transaction_code` varchar(60) COLLATE utf8mb4_unicode_ci NOT NULL,
  `entry_date` date NOT NULL,
  `narration` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `reference` varchar(120) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `gl_account_id` bigint UNSIGNED NOT NULL,
  `subaccount_id` bigint UNSIGNED DEFAULT NULL,
  `contra_gl_account_id` bigint UNSIGNED DEFAULT NULL,
  `contra_subaccount_id` bigint UNSIGNED DEFAULT NULL,
  `debit` decimal(18,2) NOT NULL DEFAULT '0.00',
  `credit` decimal(18,2) NOT NULL DEFAULT '0.00',
  `quantity` decimal(18,4) DEFAULT NULL,
  `unit_price` decimal(18,2) DEFAULT NULL,
  `discount` decimal(18,2) DEFAULT '0.00',
  `tax_amount` decimal(18,2) DEFAULT '0.00',
  `tax_id` bigint UNSIGNED DEFAULT NULL,
  `line_total` decimal(18,2) NOT NULL,
  `source` enum('invoice','supplier_invoice','receipt','quotation','journal','cashbook','payment','adjustment','other') COLLATE utf8mb4_unicode_ci DEFAULT 'journal',
  `related_type` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `related_id` bigint UNSIGNED DEFAULT NULL,
  `batch_code` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `document_path` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `currency_id` bigint UNSIGNED NOT NULL,
  `exchange_rate` decimal(18,6) DEFAULT '1.000000',
  `posted` tinyint(1) DEFAULT '0',
  `posted_at` datetime DEFAULT NULL,
  `is_reconciled` tinyint(1) DEFAULT '0',
  `reconcile_reference` varchar(120) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `client_id` bigint UNSIGNED DEFAULT NULL,
  `case_id` bigint UNSIGNED DEFAULT NULL,
  `supplier_id` bigint UNSIGNED DEFAULT NULL,
  `created_by` bigint UNSIGNED DEFAULT NULL,
  `updated_by` bigint UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`transaction_id`),
  UNIQUE KEY `transaction_code` (`transaction_code`),
  KEY `idx_transactions_related` (`related_type`,`related_id`),
  KEY `idx_transactions_entry_date` (`entry_date`),
  KEY `gl_account_id` (`gl_account_id`),
  KEY `subaccount_id` (`subaccount_id`),
  KEY `contra_gl_account_id` (`contra_gl_account_id`),
  KEY `contra_subaccount_id` (`contra_subaccount_id`),
  KEY `tax_id` (`tax_id`),
  KEY `idx_transactions_source` (`source`),
  KEY `currency_id` (`currency_id`),
  KEY `idx_transactions_posted` (`posted`),
  KEY `idx_transactions_client` (`client_id`),
  KEY `idx_transactions_case` (`case_id`),
  KEY `created_by` (`created_by`),
  KEY `updated_by` (`updated_by`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `trust_account_matters`
--

DROP TABLE IF EXISTS `trust_account_matters`;
CREATE TABLE IF NOT EXISTS `trust_account_matters` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `trust_account_id` bigint UNSIGNED NOT NULL,
  `matter_id` bigint UNSIGNED NOT NULL,
  `created_by` bigint UNSIGNED DEFAULT NULL,
  `updated_by` bigint UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uniq_trust_account_matter` (`trust_account_id`,`matter_id`),
  KEY `trust_account_matters_trust_account_id_index` (`trust_account_id`),
  KEY `trust_account_matters_matter_id_index` (`matter_id`),
  KEY `trust_account_matters_created_by_index` (`created_by`),
  KEY `trust_account_matters_updated_by_index` (`updated_by`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `trust_account_matters`
--

INSERT INTO `trust_account_matters` (`id`, `trust_account_id`, `matter_id`, `created_by`, `updated_by`, `created_at`, `updated_at`) VALUES
(1, 1, 52, 1, 1, '2026-03-24 18:21:43', '2026-03-24 18:21:43');

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

--
-- Table structure for table `trust_account_reconciliations`
--

DROP TABLE IF EXISTS `trust_account_reconciliations`;
CREATE TABLE IF NOT EXISTS `trust_account_reconciliations` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `cashbook_id` bigint UNSIGNED NOT NULL,
  `reconciliation_date` date NOT NULL,
  `bank_balance` decimal(15,2) NOT NULL,
  `system_balance` decimal(15,2) NOT NULL,
  `difference` decimal(15,2) NOT NULL,
  `notes` text COLLATE utf8mb4_unicode_ci,
  `created_by` bigint UNSIGNED DEFAULT NULL,
  `updated_by` bigint UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `trust_account_reconciliations_created_by_foreign` (`created_by`),
  KEY `trust_account_reconciliations_updated_by_foreign` (`updated_by`),
  KEY `trust_account_reconciliations_cashbook_id_index` (`cashbook_id`),
  KEY `trust_account_reconciliations_reconciliation_date_index` (`reconciliation_date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `trust_ledger_entries`
--

DROP TABLE IF EXISTS `trust_ledger_entries`;
CREATE TABLE IF NOT EXISTS `trust_ledger_entries` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `trust_account_id` bigint UNSIGNED NOT NULL,
  `trust_transaction_id` bigint UNSIGNED NOT NULL,
  `entry_date` date NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `debit` decimal(15,2) NOT NULL DEFAULT '0.00',
  `credit` decimal(15,2) NOT NULL DEFAULT '0.00',
  `running_balance` decimal(15,2) NOT NULL,
  `created_by` bigint UNSIGNED DEFAULT NULL,
  `updated_by` bigint UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `trust_ledger_entries_created_by_foreign` (`created_by`),
  KEY `trust_ledger_entries_updated_by_foreign` (`updated_by`),
  KEY `trust_ledger_entries_trust_account_id_index` (`trust_account_id`),
  KEY `trust_ledger_entries_trust_transaction_id_index` (`trust_transaction_id`),
  KEY `trust_ledger_entries_entry_date_index` (`entry_date`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `trust_ledger_entries`
--

INSERT INTO `trust_ledger_entries` (`id`, `trust_account_id`, `trust_transaction_id`, `entry_date`, `description`, `debit`, `credit`, `running_balance`, `created_by`, `updated_by`, `created_at`, `updated_at`) VALUES
(1, 1, 1, '2026-03-25', 'deposit for matter fees', 500.50, 0.00, 500.50, 1, 1, '2026-03-25 11:10:33', '2026-03-25 11:10:33');

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

--
-- Table structure for table `trust_transactions`
--

DROP TABLE IF EXISTS `trust_transactions`;
CREATE TABLE IF NOT EXISTS `trust_transactions` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `trust_account_id` bigint UNSIGNED NOT NULL,
  `cashbook_id` bigint UNSIGNED NOT NULL,
  `journal_header_id` bigint UNSIGNED NOT NULL,
  `transaction_type` enum('deposit','withdrawal','transfer_to_business','disbursement','refund') COLLATE utf8mb4_unicode_ci NOT NULL,
  `amount` decimal(15,2) NOT NULL,
  `reference` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `description` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `transaction_date` date NOT NULL,
  `status` enum('pending','posted','reversed') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'pending',
  `created_by` bigint UNSIGNED DEFAULT NULL,
  `updated_by` bigint UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `trust_transactions_cashbook_id_foreign` (`cashbook_id`),
  KEY `trust_transactions_journal_header_id_foreign` (`journal_header_id`),
  KEY `trust_transactions_created_by_foreign` (`created_by`),
  KEY `trust_transactions_updated_by_foreign` (`updated_by`),
  KEY `trust_transactions_trust_account_id_index` (`trust_account_id`),
  KEY `trust_transactions_transaction_type_index` (`transaction_type`),
  KEY `trust_transactions_transaction_date_index` (`transaction_date`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `trust_transactions`
--

INSERT INTO `trust_transactions` (`id`, `trust_account_id`, `cashbook_id`, `journal_header_id`, `transaction_type`, `amount`, `reference`, `description`, `transaction_date`, `status`, `created_by`, `updated_by`, `created_at`, `updated_at`) VALUES
(1, 1, 1, 12, 'deposit', 500.50, 'DEPOSIT', 'deposit for matter fees', '2026-03-25', 'posted', 1, 1, '2026-03-25 11:10:33', '2026-03-25 11:10:33');

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

--
-- Table structure for table `trust_transfers`
--

DROP TABLE IF EXISTS `trust_transfers`;
CREATE TABLE IF NOT EXISTS `trust_transfers` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `trust_transaction_id` bigint UNSIGNED NOT NULL,
  `from_cashbook_id` bigint UNSIGNED NOT NULL,
  `to_cashbook_id` bigint UNSIGNED NOT NULL,
  `amount` decimal(15,2) NOT NULL,
  `transfer_date` date NOT NULL,
  `created_by` bigint UNSIGNED DEFAULT NULL,
  `updated_by` bigint UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `trust_transfers_created_by_foreign` (`created_by`),
  KEY `trust_transfers_updated_by_foreign` (`updated_by`),
  KEY `trust_transfers_trust_transaction_id_index` (`trust_transaction_id`),
  KEY `trust_transfers_from_cashbook_id_index` (`from_cashbook_id`),
  KEY `trust_transfers_to_cashbook_id_index` (`to_cashbook_id`),
  KEY `trust_transfers_transfer_date_index` (`transfer_date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `uploaded_chat_files`
--

DROP TABLE IF EXISTS `uploaded_chat_files`;
CREATE TABLE IF NOT EXISTS `uploaded_chat_files` (
  `file_id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `user_id` bigint UNSIGNED NOT NULL,
  `updated_by` bigint UNSIGNED DEFAULT NULL,
  `chat_id` bigint UNSIGNED DEFAULT NULL,
  `file_name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `file_type` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `file_size` bigint DEFAULT NULL,
  `file_url` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `uploaded_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`file_id`),
  KEY `user_id` (`user_id`),
  KEY `chat_id` (`chat_id`),
  KEY `uploaded_chat_files_updated_by_index` (`updated_by`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `users`
--

DROP TABLE IF EXISTS `users`;
CREATE TABLE IF NOT EXISTS `users` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `created_by` int DEFAULT NULL,
  `name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `password_hash` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `group_id` bigint UNSIGNED DEFAULT NULL,
  `tier_id` bigint UNSIGNED DEFAULT NULL,
  `status` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT 'active',
  `location` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `is_2fa_enabled` tinyint(1) DEFAULT '0',
  `uses_authenticator` tinyint(1) DEFAULT '0',
  `uses_sms` tinyint(1) DEFAULT '0',
  `authenticator_secret` text COLLATE utf8mb4_unicode_ci,
  `sms_verified` tinyint(1) DEFAULT '0',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `failed_login_attempts` int DEFAULT '0',
  `account_locked_until` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `email` (`email`),
  KEY `idx_users_email` (`email`),
  KEY `idx_users_group_id` (`group_id`),
  KEY `idx_users_tier_id` (`tier_id`),
  KEY `idx_users_status` (`status`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `users`
--

INSERT INTO `users` (`id`, `created_by`, `name`, `email`, `password_hash`, `group_id`, `tier_id`, `status`, `location`, `is_2fa_enabled`, `uses_authenticator`, `uses_sms`, `authenticator_secret`, `sms_verified`, `created_at`, `updated_at`, `failed_login_attempts`, `account_locked_until`) VALUES
(1, NULL, 'Ashley Gwena', 'ashleygwena@outlook.com', '$2y$12$FFTuw0zl.RtcbTi.YBEfCeE6bTiQjk76xWm62Mkk6lEAZqivZllF6', 1, 1, 'online', 'Default', 0, 0, 0, NULL, 0, '2026-01-02 08:00:54', '2026-04-01 05:56:34', 0, '2026-01-02 13:22:37'),
(2, NULL, 'Tadi Ashley', 'tadiwagwena@melsoftzim.co.zw', '$2y$12$H3861T8P5SIN1QpsR801MuVywYby7tAzRPDAXx.f1WwcbwS74PAZu', 1, 2, 'online', 'Default', 0, 0, 0, NULL, 0, '2026-01-02 08:00:54', '2026-03-15 06:51:35', 0, NULL),
(3, 1, 'Test Admin Staff', 'test.admin.staff@prolex.local', '$2y$12$NL4wkpZmQhZBp4QMuRWN5euk6JGYJEZNxBn5cLiy/kYYNGHvPDgzS', 4, 5, 'active', 'HQ', 0, 0, 0, NULL, 0, '2026-02-26 12:02:35', '2026-02-26 12:02:35', 0, NULL),
(4, 1, 'Test Compliance Auditor', 'test.compliance.auditor@prolex.local', '$2y$12$VSNLLSR47un5iOmk1WbpZepUQ1pYif724ZrjP3/.h2jN0tJMQWDeq', 1, 6, 'active', 'HQ', 0, 0, 0, NULL, 0, '2026-02-26 12:02:35', '2026-02-26 12:02:35', 0, NULL),
(5, 1, 'Test Junior Lawyer', 'test.junior.lawyer@prolex.local', '$2y$12$thvulpFyAE9R4RvlH9ZWH.a3OmGjbCYyrmVjwv5pcKkKkUvqLcR8q', 3, 7, 'active', 'HQ', 0, 0, 0, NULL, 0, '2026-02-26 12:02:35', '2026-02-26 12:02:35', 0, NULL),
(6, 1, 'Test Paralegal', 'test.paralegal@prolex.local', '$2y$12$Rqn1LEbUMiAUsaa4LptfS.nRPz86ezuk9601Mvh.mM2jRNHe3Lyh6', 3, 8, 'active', 'HQ', 0, 0, 0, NULL, 0, '2026-02-26 12:02:35', '2026-02-26 12:02:35', 0, NULL),
(7, 1, 'Test Legal Intern', 'test.legal.intern@prolex.local', '$2y$12$vlO8GGmtcQmgpLJES58uf.cFqMBl3pMrZKV6L83LtBIj9236PRv1G', 3, 9, 'active', 'HQ', 0, 0, 0, NULL, 0, '2026-02-26 12:02:35', '2026-02-26 12:02:35', 0, NULL),
(8, NULL, 'Seed User 8', 'seed.user8@example.com', '$2y$12$WiQEdQ2w.4tne8vRBTC7duivEa5Blwnrf3Y6vKVHLpP3TQ4YygouC', NULL, NULL, 'active', 'Seeded', 0, 0, 0, NULL, 0, '2026-03-19 11:04:56', '2026-03-19 11:04:56', 0, NULL),
(9, NULL, 'Seed User 9', 'seed.user9@example.com', '$2y$12$dHN7y26YdjlMKjONY9epu.X4lFh.WTDTdVC/v1Lmga.XkXsxvohFC', NULL, NULL, 'active', 'Seeded', 0, 0, 0, NULL, 0, '2026-03-19 11:04:57', '2026-03-19 11:04:57', 0, NULL),
(10, NULL, 'Seed User 10', 'seed.user10@example.com', '$2y$12$Ig9IHzVhEqE57nnj9r9OjeU2AWOzwmkT.vguXt6hoGQl7OkY.kwcC', NULL, NULL, 'active', 'Seeded', 0, 0, 0, NULL, 0, '2026-03-19 11:04:57', '2026-03-19 11:04:57', 0, NULL);

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

--
-- Table structure for table `user_chat_settings`
--

DROP TABLE IF EXISTS `user_chat_settings`;
CREATE TABLE IF NOT EXISTS `user_chat_settings` (
  `setting_id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `user_id` bigint UNSIGNED NOT NULL,
  `updated_by` bigint UNSIGNED DEFAULT NULL,
  `enable_sound` tinyint(1) DEFAULT '1',
  `auto_scroll` tinyint(1) DEFAULT '1',
  `show_typing_indicators` tinyint(1) DEFAULT '1',
  `dark_mode` tinyint(1) DEFAULT '0',
  `show_online_status` tinyint(1) DEFAULT '1',
  `save_chat_history` tinyint(1) DEFAULT '1',
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`setting_id`),
  UNIQUE KEY `user_chat_settings_user_id_unique` (`user_id`),
  KEY `user_id` (`user_id`),
  KEY `user_chat_settings_updated_by_index` (`updated_by`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `user_groups`
--

DROP TABLE IF EXISTS `user_groups`;
CREATE TABLE IF NOT EXISTS `user_groups` (
  `user_group_id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `group_name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `group_description` text COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `created_by` bigint UNSIGNED DEFAULT NULL,
  `updated_by` bigint UNSIGNED DEFAULT NULL,
  PRIMARY KEY (`user_group_id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `user_groups`
--

INSERT INTO `user_groups` (`user_group_id`, `group_name`, `group_description`, `created_at`, `updated_at`, `created_by`, `updated_by`) VALUES
(1, 'System Auditors', 'Highest-level oversight role with authority to monitor, review, and audit all system activities, financial records, user actions, and compliance logs. Has supervisory access over administrators.', '2026-02-21 19:19:42', '2026-02-21 19:19:42', 1, 1),
(2, 'Administrators', 'System administrators responsible for managing users, cases, billing, configurations, and daily system operations.', '2026-02-21 19:19:42', '2026-02-21 19:19:42', 1, 1),
(3, 'Lawyers', 'Attorneys responsible for managing legal cases, clients, court filings, and legal documentation.', '2026-02-21 19:19:42', '2026-02-21 19:19:42', 1, 1),
(4, 'Secretaries', 'Administrative staff responsible for scheduling, document preparation, file organization, and client communication support.', '2026-02-21 19:19:42', '2026-02-21 19:19:42', 1, 1);

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

--
-- Table structure for table `user_permissions`
--

DROP TABLE IF EXISTS `user_permissions`;
CREATE TABLE IF NOT EXISTS `user_permissions` (
  `user_permission_id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `user_id` bigint UNSIGNED NOT NULL,
  `feature_id` bigint UNSIGNED NOT NULL,
  `can_view` tinyint(1) NOT NULL DEFAULT '0',
  `can_add` tinyint(1) NOT NULL DEFAULT '0',
  `can_edit` tinyint(1) NOT NULL DEFAULT '0',
  `can_delete` tinyint(1) NOT NULL DEFAULT '0',
  `can_export` tinyint(1) NOT NULL DEFAULT '0',
  `can_print` tinyint(1) NOT NULL DEFAULT '0',
  `can_approve` tinyint(1) NOT NULL DEFAULT '0',
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `override_reason` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_by` bigint UNSIGNED NOT NULL,
  `updated_by` bigint UNSIGNED DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`user_permission_id`),
  UNIQUE KEY `uq_user_feature` (`user_id`,`feature_id`),
  KEY `fk_user_perm_feature` (`feature_id`),
  KEY `fk_user_perm_created_by` (`created_by`),
  KEY `fk_user_perm_updated_by` (`updated_by`)
) ENGINE=InnoDB AUTO_INCREMENT=52 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `user_permissions`
--

INSERT INTO `user_permissions` (`user_permission_id`, `user_id`, `feature_id`, `can_view`, `can_add`, `can_edit`, `can_delete`, `can_export`, `can_print`, `can_approve`, `is_active`, `override_reason`, `created_by`, `updated_by`, `created_at`, `updated_at`) VALUES
(1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 'Manual override via administration permissions UI', 1, 1, '2026-03-26 11:18:39', '2026-03-26 11:18:39'),
(2, 1, 2, 1, 1, 1, 1, 0, 0, 0, 1, 'Manual override via administration permissions UI', 1, 1, '2026-03-26 11:18:39', '2026-03-26 11:18:39'),
(3, 1, 3, 1, 1, 1, 1, 0, 0, 0, 1, 'Manual override via administration permissions UI', 1, 1, '2026-03-26 11:18:39', '2026-03-26 11:18:39'),
(4, 1, 4, 1, 1, 1, 1, 0, 0, 0, 1, 'Manual override via administration permissions UI', 1, 1, '2026-03-26 11:18:39', '2026-03-26 11:18:39'),
(5, 1, 5, 1, 1, 1, 1, 0, 0, 0, 1, 'Manual override via administration permissions UI', 1, 1, '2026-03-26 11:18:39', '2026-03-26 11:18:39'),
(6, 1, 6, 1, 1, 1, 1, 0, 0, 0, 1, 'Manual override via administration permissions UI', 1, 1, '2026-03-26 11:18:39', '2026-03-26 11:18:39'),
(7, 1, 7, 1, 1, 1, 1, 0, 0, 0, 1, 'Manual override via administration permissions UI', 1, 1, '2026-03-26 11:18:39', '2026-03-26 11:18:39'),
(8, 1, 8, 1, 1, 1, 1, 0, 0, 0, 1, 'Manual override via administration permissions UI', 1, 1, '2026-03-26 11:18:39', '2026-03-26 11:18:39'),
(9, 1, 9, 1, 1, 1, 1, 0, 0, 0, 1, 'Manual override via administration permissions UI', 1, 1, '2026-03-26 11:18:39', '2026-03-26 11:18:39'),
(10, 1, 10, 1, 1, 1, 1, 0, 0, 0, 1, 'Manual override via administration permissions UI', 1, 1, '2026-03-26 11:18:39', '2026-03-26 11:18:39'),
(11, 1, 11, 1, 1, 1, 1, 0, 0, 0, 1, 'Manual override via administration permissions UI', 1, 1, '2026-03-26 11:18:39', '2026-03-26 11:18:39'),
(12, 1, 12, 1, 1, 1, 1, 0, 0, 0, 1, 'Manual override via administration permissions UI', 1, 1, '2026-03-26 11:18:39', '2026-03-26 11:18:39'),
(13, 1, 13, 1, 1, 1, 1, 0, 0, 0, 1, 'Manual override via administration permissions UI', 1, 1, '2026-03-26 11:18:39', '2026-03-26 11:18:39'),
(14, 1, 14, 1, 1, 1, 1, 0, 0, 0, 1, 'Manual override via administration permissions UI', 1, 1, '2026-03-26 11:18:39', '2026-03-26 11:18:39'),
(15, 1, 15, 1, 1, 1, 1, 0, 0, 0, 1, 'Manual override via administration permissions UI', 1, 1, '2026-03-26 11:18:39', '2026-03-26 11:18:39'),
(16, 1, 16, 1, 1, 1, 1, 0, 0, 0, 1, 'Manual override via administration permissions UI', 1, 1, '2026-03-26 11:18:39', '2026-03-26 11:18:39'),
(17, 1, 17, 1, 1, 1, 1, 0, 0, 0, 1, 'Manual override via administration permissions UI', 1, 1, '2026-03-26 11:18:39', '2026-03-26 11:18:39'),
(18, 1, 18, 1, 1, 1, 1, 0, 0, 0, 1, 'Manual override via administration permissions UI', 1, 1, '2026-03-26 11:18:39', '2026-03-26 11:18:39'),
(19, 1, 19, 1, 1, 1, 1, 0, 0, 0, 1, 'Manual override via administration permissions UI', 1, 1, '2026-03-26 11:18:39', '2026-03-26 11:18:39'),
(20, 1, 20, 1, 1, 1, 0, 0, 1, 0, 1, 'Manual override via administration permissions UI', 1, 1, '2026-03-26 11:18:39', '2026-03-26 12:44:10'),
(21, 1, 21, 1, 1, 1, 0, 0, 1, 0, 1, 'Manual override via administration permissions UI', 1, 1, '2026-03-26 11:18:39', '2026-03-26 12:44:10'),
(22, 1, 22, 1, 1, 1, 1, 0, 0, 0, 1, 'Manual override via administration permissions UI', 1, 1, '2026-03-26 11:18:39', '2026-03-26 11:18:39'),
(23, 1, 23, 1, 1, 1, 1, 0, 0, 0, 1, 'Manual override via administration permissions UI', 1, 1, '2026-03-26 11:18:39', '2026-03-26 11:18:39'),
(24, 1, 24, 1, 1, 1, 1, 0, 0, 0, 1, 'Manual override via administration permissions UI', 1, 1, '2026-03-26 11:18:39', '2026-03-26 11:18:39'),
(25, 1, 25, 1, 1, 1, 1, 0, 0, 0, 1, 'Manual override via administration permissions UI', 1, 1, '2026-03-26 11:18:39', '2026-03-26 11:18:39'),
(26, 1, 26, 1, 1, 1, 1, 0, 0, 0, 1, 'Manual override via administration permissions UI', 1, 1, '2026-03-26 11:18:39', '2026-03-26 11:18:39'),
(27, 1, 27, 1, 1, 1, 1, 0, 0, 0, 1, 'Manual override via administration permissions UI', 1, 1, '2026-03-26 11:18:39', '2026-03-26 11:18:39'),
(28, 1, 28, 1, 1, 1, 1, 0, 0, 0, 1, 'Manual override via administration permissions UI', 1, 1, '2026-03-26 11:18:39', '2026-03-26 11:18:39'),
(29, 1, 29, 1, 1, 1, 1, 0, 0, 0, 1, 'Manual override via administration permissions UI', 1, 1, '2026-03-26 11:18:39', '2026-03-26 11:18:39'),
(30, 1, 30, 1, 1, 1, 1, 0, 0, 0, 1, 'Manual override via administration permissions UI', 1, 1, '2026-03-26 11:18:39', '2026-03-26 11:18:39'),
(31, 1, 31, 1, 1, 1, 1, 0, 0, 0, 1, 'Manual override via administration permissions UI', 1, 1, '2026-03-26 11:18:39', '2026-03-26 11:18:39'),
(32, 1, 32, 1, 1, 1, 1, 0, 0, 0, 1, 'Manual override via administration permissions UI', 1, 1, '2026-03-26 11:18:39', '2026-03-26 11:18:39'),
(33, 1, 33, 1, 1, 1, 1, 0, 0, 0, 1, 'Manual override via administration permissions UI', 1, 1, '2026-03-26 11:18:39', '2026-03-26 11:18:39'),
(34, 1, 34, 1, 1, 1, 1, 0, 0, 0, 1, 'Manual override via administration permissions UI', 1, 1, '2026-03-26 11:18:39', '2026-03-26 11:18:39'),
(35, 1, 35, 1, 1, 1, 1, 0, 0, 0, 1, 'Manual override via administration permissions UI', 1, 1, '2026-03-26 11:18:39', '2026-03-26 11:18:39'),
(36, 1, 36, 1, 1, 1, 1, 0, 0, 0, 1, 'Manual override via administration permissions UI', 1, 1, '2026-03-26 11:18:39', '2026-03-26 11:18:39'),
(37, 1, 37, 1, 1, 1, 1, 0, 0, 0, 1, 'Manual override via administration permissions UI', 1, 1, '2026-03-26 11:18:39', '2026-03-26 11:18:39'),
(38, 1, 38, 1, 1, 1, 1, 0, 0, 0, 1, 'Manual override via administration permissions UI', 1, 1, '2026-03-26 11:18:39', '2026-03-26 11:18:39'),
(39, 1, 39, 1, 1, 1, 1, 0, 0, 0, 1, 'Manual override via administration permissions UI', 1, 1, '2026-03-26 11:18:40', '2026-03-26 11:18:40'),
(40, 1, 40, 1, 1, 1, 1, 0, 0, 0, 1, 'Manual override via administration permissions UI', 1, 1, '2026-03-26 11:18:40', '2026-03-26 11:18:40'),
(41, 1, 41, 1, 1, 1, 1, 0, 0, 0, 1, 'Manual override via administration permissions UI', 1, 1, '2026-03-26 11:18:40', '2026-03-26 11:18:40'),
(42, 1, 42, 1, 1, 1, 1, 0, 0, 0, 1, 'Manual override via administration permissions UI', 1, 1, '2026-03-26 11:18:40', '2026-03-26 11:18:40'),
(43, 1, 43, 1, 1, 1, 1, 0, 0, 0, 1, 'Manual override via administration permissions UI', 1, 1, '2026-03-26 11:18:40', '2026-03-26 11:18:40'),
(44, 1, 44, 1, 1, 1, 1, 0, 0, 0, 1, 'Manual override via administration permissions UI', 1, 1, '2026-03-26 11:18:40', '2026-03-26 11:18:40'),
(45, 1, 45, 1, 1, 1, 1, 0, 0, 0, 1, 'Manual override via administration permissions UI', 1, 1, '2026-03-26 11:18:40', '2026-03-26 11:18:40'),
(46, 1, 46, 1, 1, 1, 1, 0, 0, 0, 1, 'Manual override via administration permissions UI', 1, 1, '2026-03-26 11:18:40', '2026-03-26 11:18:40'),
(47, 1, 47, 1, 1, 1, 1, 0, 1, 0, 1, 'Manual override via administration permissions UI', 1, 1, '2026-03-26 11:18:40', '2026-03-26 12:44:10'),
(48, 1, 48, 1, 1, 1, 0, 0, 1, 0, 1, 'Manual override via administration permissions UI', 1, 1, '2026-03-26 11:18:40', '2026-03-26 12:44:10');

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

--
-- Table structure for table `user_phones`
--

DROP TABLE IF EXISTS `user_phones`;
CREATE TABLE IF NOT EXISTS `user_phones` (
  `phone_id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `user_id` bigint UNSIGNED NOT NULL,
  `phone_number` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
  `phone_type` enum('primary','secondary','work','emergency') COLLATE utf8mb4_unicode_ci DEFAULT 'primary',
  `is_verified` tinyint(1) DEFAULT '0',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT NULL,
  `created_by` bigint NOT NULL,
  `updated_by` bigint NOT NULL,
  PRIMARY KEY (`phone_id`),
  KEY `idx_user_phones_user_id` (`user_id`),
  KEY `idx_user_phones_number` (`phone_number`),
  KEY `idx_user_phones_verified` (`is_verified`),
  KEY `fk_user_phones_created_by` (`created_by`),
  KEY `fk_user_phones_updated_by` (`updated_by`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `user_phones`
--

INSERT INTO `user_phones` (`phone_id`, `user_id`, `phone_number`, `phone_type`, `is_verified`, `created_at`, `updated_at`, `created_by`, `updated_by`) VALUES
(1, 1, '+263771234567', 'primary', 1, '2026-02-21 21:46:42', '2026-02-21 21:46:42', 1, 1),
(2, 2, '+263782345678', 'work', 1, '2026-02-21 21:46:42', '2026-02-21 21:46:42', 1, 1),
(3, 3, '+12025551051', 'primary', 1, '2026-02-26 12:02:35', '2026-02-26 12:02:35', 1, 1),
(4, 4, '+12025551052', 'primary', 1, '2026-02-26 12:02:35', '2026-02-26 12:02:35', 1, 1),
(5, 5, '+12025551053', 'primary', 1, '2026-02-26 12:02:35', '2026-02-26 12:02:35', 1, 1),
(6, 6, '+12025551054', 'primary', 1, '2026-02-26 12:02:35', '2026-02-26 12:02:35', 1, 1),
(7, 7, '+12025551055', 'primary', 1, '2026-02-26 12:02:35', '2026-02-26 12:02:35', 1, 1);

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

--
-- Table structure for table `user_sessions`
--

DROP TABLE IF EXISTS `user_sessions`;
CREATE TABLE IF NOT EXISTS `user_sessions` (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `user_id` bigint UNSIGNED NOT NULL,
  `session_id` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `ip_address` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `user_agent` text COLLATE utf8mb4_unicode_ci,
  `logged_in_at` datetime NOT NULL,
  `last_seen_at` datetime DEFAULT NULL,
  `logged_out_at` datetime DEFAULT NULL,
  `status` enum('active','logged_out','revoked') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'active',
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_user_id` (`user_id`),
  KEY `idx_session_id` (`session_id`),
  KEY `idx_status` (`status`)
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `user_sessions`
--

INSERT INTO `user_sessions` (`id`, `user_id`, `session_id`, `ip_address`, `user_agent`, `logged_in_at`, `last_seen_at`, `logged_out_at`, `status`, `created_at`, `updated_at`) VALUES
(1, 1, '1sKY7zAUaUOvWgZkT2T2XAEkmXGYcamsnKGWY0cN', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-04-02 13:10:51', NULL, NULL, 'active', '2026-04-02 13:10:51', '2026-04-02 13:10:51'),
(2, 1, '1sKY7zAUaUOvWgZkT2T2XAEkmXGYcamsnKGWY0cN', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-04-02 13:10:51', NULL, NULL, 'active', '2026-04-02 13:10:51', '2026-04-02 13:10:51'),
(3, 1, 'w44muXRjHW1TK1soOl3o8MNmfawTTMoXR4CyYfFS', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-04-02 13:10:52', '2026-04-02 13:10:52', NULL, 'active', '2026-04-02 13:10:52', '2026-04-02 13:10:52'),
(4, 1, 'U0cinE5praqbyFcNOg5FEOK0o6usHrU62YjC7gH8', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-04-06 08:20:10', NULL, NULL, 'active', '2026-04-06 08:20:10', '2026-04-06 08:20:10'),
(5, 1, 'U0cinE5praqbyFcNOg5FEOK0o6usHrU62YjC7gH8', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-04-06 08:20:10', NULL, NULL, 'active', '2026-04-06 08:20:10', '2026-04-06 08:20:10'),
(6, 1, 'GUdeBQQK2yrkhv6MXXtzeWRDB3CURS2JGfvldrj3', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-04-06 08:20:10', '2026-04-06 08:20:10', NULL, 'active', '2026-04-06 08:20:10', '2026-04-06 08:20:10'),
(7, 1, 'dzNlHQFdeb4PvA6bnzfFoMqFVzCjqi4QpmcA3sbs', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-04-07 07:29:05', NULL, NULL, 'active', '2026-04-07 07:29:05', '2026-04-07 07:29:05'),
(8, 1, 'dzNlHQFdeb4PvA6bnzfFoMqFVzCjqi4QpmcA3sbs', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-04-07 07:29:05', NULL, NULL, 'active', '2026-04-07 07:29:05', '2026-04-07 07:29:05'),
(9, 1, 'qB7LqXxJVWDSg4QvzT8oUZzslfozhTsqAbUGeGwi', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-04-07 07:29:05', '2026-04-07 07:29:05', NULL, 'active', '2026-04-07 07:29:05', '2026-04-07 07:29:05'),
(10, 1, 'dj9BRLmfOWkcGH6Ykekc7wpRkBpGqX6MFr7JBVPX', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-04-07 07:43:30', NULL, NULL, 'active', '2026-04-07 07:43:30', '2026-04-07 07:43:30'),
(11, 1, 'dj9BRLmfOWkcGH6Ykekc7wpRkBpGqX6MFr7JBVPX', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-04-07 07:43:30', NULL, NULL, 'active', '2026-04-07 07:43:30', '2026-04-07 07:43:30'),
(12, 1, 'gdxB551lN7jqIMZ1CZDUz6PWdVUqYIHWpoyvidJs', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-04-07 07:43:30', '2026-04-07 07:43:30', NULL, 'active', '2026-04-07 07:43:30', '2026-04-07 07:43:30'),
(13, 1, '9H1pU3gcDLsPYlReia36KQHvCZXN2LJoMwiAsTPa', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-04-07 08:13:24', NULL, NULL, 'active', '2026-04-07 08:13:24', '2026-04-07 08:13:24'),
(14, 1, '9H1pU3gcDLsPYlReia36KQHvCZXN2LJoMwiAsTPa', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-04-07 08:13:24', NULL, NULL, 'active', '2026-04-07 08:13:24', '2026-04-07 08:13:24'),
(15, 1, '5ESdIqwmJUaVsWw0BxdIdutgrTCllgE9iAeYUO6P', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-04-07 08:13:24', '2026-04-07 08:13:24', NULL, 'active', '2026-04-07 08:13:24', '2026-04-07 08:13:24');

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

--
-- Table structure for table `user_tiers`
--

DROP TABLE IF EXISTS `user_tiers`;
CREATE TABLE IF NOT EXISTS `user_tiers` (
  `tier_id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `user_group_id` bigint UNSIGNED DEFAULT NULL,
  `tier_name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`tier_id`),
  KEY `fk_user_tiers_user_group` (`user_group_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `user_tiers`
--

INSERT INTO `user_tiers` (`tier_id`, `user_group_id`, `tier_name`, `description`, `created_at`, `updated_at`) VALUES
(1, 1, 'Superuser', 'Ultimate system authority with unrestricted access including override and system-level controls.', '2026-01-05 14:08:22', '2026-02-21 19:34:23'),
(2, 1, 'Oversight Auditor', 'High-level audit authority with full system visibility and compliance monitoring privileges.', '2026-01-05 14:08:22', '2026-02-21 19:34:23'),
(3, 2, 'Administrative Manager', 'Manages users, system configurations, billing, and operational workflows.', '2026-01-05 14:08:22', '2026-02-21 19:34:23'),
(4, 3, 'Senior Lawyer', 'Handles complex legal cases, court representation, and supervises junior lawyers and paralegals.', '2026-01-05 14:08:22', '2026-02-21 19:34:23'),
(5, 4, 'Administrative Staff', 'Provides scheduling, documentation, and clerical support to legal and administrative teams.', '2026-01-05 14:08:22', '2026-02-21 19:34:23'),
(6, 1, 'System Compliance Auditor', 'Read-only system access for compliance verification and activity auditing.', '2026-01-05 14:08:22', '2026-02-21 19:34:23'),
(7, 3, 'Junior Lawyer', 'Handles assigned cases under supervision of a Senior Lawyer with limited approval authority.', '2026-02-21 19:35:15', '2026-02-21 19:35:15'),
(8, 3, 'Paralegal', 'Performs legal research, drafts documents, and assists lawyers in case preparation.', '2026-02-21 19:35:15', '2026-02-21 19:35:15'),
(9, 3, 'Legal Intern', 'Restricted legal access for training purposes under direct supervision.', '2026-02-21 19:35:15', '2026-02-21 19:35:15');

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

--
-- Stand-in structure for view `vw_active_tariffs`
-- (See below for the actual view)
--
DROP VIEW IF EXISTS `vw_active_tariffs`;
CREATE TABLE IF NOT EXISTS `vw_active_tariffs` (
`tariff_id` int
,`service_code` varchar(30)
,`service_name` varchar(150)
,`billing_method` enum('FIXED_FEE','HOURLY','PER_APPEARANCE','PER_STAGE','RETAINER_PLUS','CONTINGENCY','SUBSCRIPTION')
,`rate_type` enum('PER_HOUR','PER_CASE','PER_DOCUMENT','PER_APPEARANCE','PER_CONSULTATION','PER_MONTH','PERCENTAGE')
,`rate_amount` decimal(12,2)
,`billing_increment` int
,`minimum_billable_mins` int
,`minimum_fee` decimal(12,2)
,`maximum_fee` decimal(12,2)
,`vat_rate` decimal(5,2)
,`effective_from` date
,`effective_to` date
,`lawyer_name` varchar(201)
,`lawyer_type` varchar(50)
,`practice_group` varchar(100)
);

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

--
-- Stand-in structure for view `vw_invoice_detail`
-- (See below for the actual view)
--
DROP VIEW IF EXISTS `vw_invoice_detail`;
CREATE TABLE IF NOT EXISTS `vw_invoice_detail` (
`invoice_id` bigint unsigned
,`invoice_number` varchar(50)
,`invoice_date` date
,`due_date` date
,`invoice_status` enum('draft','sent','partial','paid','overdue','cancelled','written_off')
,`client_name` varchar(201)
,`responsible_lawyer` varchar(20)
,`lawyer_name` varchar(201)
,`line_id` bigint unsigned
,`charge_type` enum('FIXED_FEE','HOURLY','PER_APPEARANCE','RETAINER_DRAW','ADJUSTMENT')
,`service_name` varchar(255)
,`rate_snapshot` decimal(12,2)
,`hours_decimal` decimal(8,4)
,`quantity` decimal(10,4)
,`base_amount` decimal(12,2)
,`discount_pct` decimal(5,2)
,`discount_amount` decimal(12,2)
,`line_total` decimal(12,2)
,`disbursement_total` decimal(12,2)
,`tax_total` decimal(12,2)
,`total` decimal(12,2)
,`amount_paid` decimal(12,2)
,`balance_due` decimal(12,2)
);

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

--
-- Stand-in structure for view `vw_lawyer_earnings`
-- (See below for the actual view)
--
DROP VIEW IF EXISTS `vw_lawyer_earnings`;
CREATE TABLE IF NOT EXISTS `vw_lawyer_earnings` (
`lawyer_id` varchar(20)
,`lawyer_name` varchar(201)
,`lawyer_type` varchar(50)
,`work_year` year
,`work_month` int
,`entry_count` bigint
,`total_minutes` decimal(32,0)
,`total_hours` decimal(36,2)
,`billable_minutes` decimal(32,0)
,`billable_hours` decimal(36,2)
,`gross_earnings` decimal(34,2)
,`invoiced_earnings` decimal(34,2)
,`written_off` decimal(34,2)
,`unbilled_wip` decimal(34,2)
);

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

--
-- Stand-in structure for view `vw_outstanding_invoices`
-- (See below for the actual view)
--
DROP VIEW IF EXISTS `vw_outstanding_invoices`;
CREATE TABLE IF NOT EXISTS `vw_outstanding_invoices` (
`id` bigint unsigned
,`invoice_number` varchar(50)
,`invoice_date` date
,`due_date` date
,`days_overdue` int
,`age_bucket` varchar(10)
,`client_name` varchar(201)
,`total` decimal(12,2)
,`amount_paid` decimal(12,2)
,`balance_due` decimal(12,2)
,`status` enum('draft','sent','partial','paid','overdue','cancelled','written_off')
);

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

--
-- Stand-in structure for view `vw_unbilled_wip`
-- (See below for the actual view)
--
DROP VIEW IF EXISTS `vw_unbilled_wip`;
CREATE TABLE IF NOT EXISTS `vw_unbilled_wip` (
`client_id` bigint unsigned
,`client_name` varchar(201)
,`matter_id` bigint unsigned
,`case_id` bigint unsigned
,`lawyer_id` varchar(20)
,`lawyer_name` varchar(201)
,`entry_count` bigint
,`total_minutes` decimal(32,0)
,`total_hours` decimal(36,2)
,`wip_value` decimal(34,2)
,`earliest_date` date
,`latest_date` date
);

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

--
-- Stand-in structure for view `v_gl_subaccount_display`
-- (See below for the actual view)
--
DROP VIEW IF EXISTS `v_gl_subaccount_display`;
CREATE TABLE IF NOT EXISTS `v_gl_subaccount_display` (
`id` bigint unsigned
,`parent_code` varchar(20)
,`sub_code` varchar(20)
,`full_gl_code` varchar(41)
,`account_name` varchar(255)
,`parent_name` varchar(255)
,`financial_category` enum('income_statement','balance_sheet')
,`is_control_account` tinyint(1)
,`is_trust_account` tinyint(1)
,`is_active` tinyint(1)
);

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

--
-- Structure for view `vw_active_tariffs`
--
DROP TABLE IF EXISTS `vw_active_tariffs`;

DROP VIEW IF EXISTS `vw_active_tariffs`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY INVOKER VIEW `vw_active_tariffs`  AS SELECT `t`.`tariff_id` AS `tariff_id`, `t`.`service_code` AS `service_code`, `t`.`service_name` AS `service_name`, `t`.`billing_method` AS `billing_method`, `t`.`rate_type` AS `rate_type`, `t`.`rate_amount` AS `rate_amount`, `t`.`billing_increment` AS `billing_increment`, `t`.`minimum_billable_mins` AS `minimum_billable_mins`, `t`.`minimum_fee` AS `minimum_fee`, `t`.`maximum_fee` AS `maximum_fee`, `t`.`vat_rate` AS `vat_rate`, `t`.`effective_from` AS `effective_from`, `t`.`effective_to` AS `effective_to`, concat(`l`.`first_name`,' ',`l`.`last_name`) AS `lawyer_name`, `l`.`lawyer_type` AS `lawyer_type`, `lg`.`group_name` AS `practice_group` FROM ((`tariffs` `t` join `lawyers` `l` on((`l`.`lawyer_id` = `t`.`lawyer_id`))) left join `lawyer_groups` `lg` on((`lg`.`group_id` = `t`.`group_id`))) WHERE ((`t`.`is_active` = 1) AND (`t`.`deleted_at` is null) AND (`t`.`effective_from` <= curdate()) AND ((`t`.`effective_to` is null) OR (`t`.`effective_to` >= curdate()))) ;

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

--
-- Structure for view `vw_invoice_detail`
--
DROP TABLE IF EXISTS `vw_invoice_detail`;

DROP VIEW IF EXISTS `vw_invoice_detail`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vw_invoice_detail`  AS SELECT `ci`.`id` AS `invoice_id`, `ci`.`invoice_number` AS `invoice_number`, `ci`.`invoice_date` AS `invoice_date`, `ci`.`due_date` AS `due_date`, `ci`.`status` AS `invoice_status`, concat(`c`.`first_name`,' ',`c`.`last_name`) AS `client_name`, `ci`.`responsible_lawyer` AS `responsible_lawyer`, concat(`l`.`first_name`,' ',`l`.`last_name`) AS `lawyer_name`, `ln`.`id` AS `line_id`, `ln`.`charge_type` AS `charge_type`, `ln`.`service_name` AS `service_name`, `ln`.`rate_snapshot` AS `rate_snapshot`, `ln`.`hours_decimal` AS `hours_decimal`, `ln`.`quantity` AS `quantity`, `ln`.`base_amount` AS `base_amount`, `ln`.`discount_pct` AS `discount_pct`, `ln`.`discount_amount` AS `discount_amount`, `ln`.`line_total` AS `line_total`, `ci`.`disbursement_total` AS `disbursement_total`, `ci`.`tax_total` AS `tax_total`, `ci`.`total` AS `total`, `ci`.`amount_paid` AS `amount_paid`, `ci`.`balance_due` AS `balance_due` FROM (((`client_invoices` `ci` join `client_invoice_lines` `ln` on((`ln`.`invoice_id` = `ci`.`id`))) join `clients` `c` on((`c`.`id` = `ci`.`client_id`))) left join `lawyers` `l` on((`l`.`lawyer_id` = `ci`.`responsible_lawyer`))) ;

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

--
-- Structure for view `vw_lawyer_earnings`
--
DROP TABLE IF EXISTS `vw_lawyer_earnings`;

DROP VIEW IF EXISTS `vw_lawyer_earnings`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vw_lawyer_earnings`  AS SELECT `tl`.`lawyer_id` AS `lawyer_id`, concat(`l`.`first_name`,' ',`l`.`last_name`) AS `lawyer_name`, `l`.`lawyer_type` AS `lawyer_type`, year(`tl`.`work_date`) AS `work_year`, month(`tl`.`work_date`) AS `work_month`, count(`tl`.`log_id`) AS `entry_count`, sum(`tl`.`rounded_minutes`) AS `total_minutes`, round((sum(`tl`.`rounded_minutes`) / 60.0),2) AS `total_hours`, sum((case when (`tl`.`is_billable` = 1) then `tl`.`rounded_minutes` else 0 end)) AS `billable_minutes`, round((sum((case when (`tl`.`is_billable` = 1) then `tl`.`rounded_minutes` else 0 end)) / 60.0),2) AS `billable_hours`, sum(`tl`.`amount`) AS `gross_earnings`, sum((case when (`tl`.`status` = 'billed') then `tl`.`amount` else 0 end)) AS `invoiced_earnings`, sum((case when (`tl`.`status` = 'written_off') then `tl`.`amount` else 0 end)) AS `written_off`, sum((case when ((`tl`.`is_billable` = 1) and (`tl`.`is_billed` = 0) and (`tl`.`status` not in ('written_off','rejected'))) then `tl`.`amount` else 0 end)) AS `unbilled_wip` FROM (`tariff_time_logs` `tl` join `lawyers` `l` on((`l`.`lawyer_id` = `tl`.`lawyer_id`))) WHERE (`tl`.`is_billable` = 1) GROUP BY `tl`.`lawyer_id`, `l`.`first_name`, `l`.`last_name`, `l`.`lawyer_type`, year(`tl`.`work_date`), month(`tl`.`work_date`) ;

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

--
-- Structure for view `vw_outstanding_invoices`
--
DROP TABLE IF EXISTS `vw_outstanding_invoices`;

DROP VIEW IF EXISTS `vw_outstanding_invoices`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vw_outstanding_invoices`  AS SELECT `ci`.`id` AS `id`, `ci`.`invoice_number` AS `invoice_number`, `ci`.`invoice_date` AS `invoice_date`, `ci`.`due_date` AS `due_date`, (to_days(curdate()) - to_days(`ci`.`due_date`)) AS `days_overdue`, (case when ((to_days(curdate()) - to_days(`ci`.`due_date`)) <= 0) then 'Current' when ((to_days(curdate()) - to_days(`ci`.`due_date`)) <= 30) then '1-30 days' when ((to_days(curdate()) - to_days(`ci`.`due_date`)) <= 60) then '31-60 days' when ((to_days(curdate()) - to_days(`ci`.`due_date`)) <= 90) then '61-90 days' else '90+ days' end) AS `age_bucket`, concat(`c`.`first_name`,' ',`c`.`last_name`) AS `client_name`, `ci`.`total` AS `total`, `ci`.`amount_paid` AS `amount_paid`, `ci`.`balance_due` AS `balance_due`, `ci`.`status` AS `status` FROM (`client_invoices` `ci` join `clients` `c` on((`c`.`id` = `ci`.`client_id`))) WHERE ((`ci`.`status` in ('sent','partial','overdue')) AND (`ci`.`balance_due` > 0)) ;

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

--
-- Structure for view `vw_unbilled_wip`
--
DROP TABLE IF EXISTS `vw_unbilled_wip`;

DROP VIEW IF EXISTS `vw_unbilled_wip`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vw_unbilled_wip`  AS SELECT `tl`.`client_id` AS `client_id`, concat(`c`.`first_name`,' ',`c`.`last_name`) AS `client_name`, `tl`.`matter_id` AS `matter_id`, `tl`.`case_id` AS `case_id`, `tl`.`lawyer_id` AS `lawyer_id`, concat(`l`.`first_name`,' ',`l`.`last_name`) AS `lawyer_name`, count(`tl`.`log_id`) AS `entry_count`, sum(`tl`.`rounded_minutes`) AS `total_minutes`, round((sum(`tl`.`rounded_minutes`) / 60.0),2) AS `total_hours`, sum(`tl`.`amount`) AS `wip_value`, min(`tl`.`work_date`) AS `earliest_date`, max(`tl`.`work_date`) AS `latest_date` FROM ((`tariff_time_logs` `tl` left join `clients` `c` on((`c`.`id` = `tl`.`client_id`))) left join `lawyers` `l` on((`l`.`lawyer_id` = `tl`.`lawyer_id`))) WHERE ((`tl`.`is_billable` = 1) AND (`tl`.`is_billed` = 0) AND (`tl`.`status` not in ('written_off','rejected'))) GROUP BY `tl`.`client_id`, `c`.`first_name`, `c`.`last_name`, `tl`.`matter_id`, `tl`.`case_id`, `tl`.`lawyer_id`, `l`.`first_name`, `l`.`last_name` ;

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

--
-- Structure for view `v_gl_subaccount_display`
--
DROP TABLE IF EXISTS `v_gl_subaccount_display`;

DROP VIEW IF EXISTS `v_gl_subaccount_display`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v_gl_subaccount_display`  AS SELECT `s`.`id` AS `id`, `p`.`account_code` AS `parent_code`, `s`.`sub_code` AS `sub_code`, concat(`p`.`account_code`,'/',`s`.`sub_code`) AS `full_gl_code`, `s`.`account_name` AS `account_name`, `p`.`account_name` AS `parent_name`, `p`.`financial_category` AS `financial_category`, `p`.`is_control_account` AS `is_control_account`, `p`.`is_trust_account` AS `is_trust_account`, `s`.`is_active` AS `is_active` FROM (`general_ledger_subaccounts` `s` join `general_ledger_parent_accounts` `p` on((`p`.`id` = `s`.`parent_id`))) WHERE ((`s`.`deleted_at` is null) AND (`p`.`deleted_at` is null)) ;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `chat_messages`
--
ALTER TABLE `chat_messages`
  ADD CONSTRAINT `chat_messages_chat_id_foreign` FOREIGN KEY (`chat_id`) REFERENCES `chat_rooms` (`chat_id`) ON DELETE CASCADE,
  ADD CONSTRAINT `chat_messages_sender_id_foreign` FOREIGN KEY (`sender_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `chat_messages_updated_by_foreign` FOREIGN KEY (`updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `chat_participants`
--
ALTER TABLE `chat_participants`
  ADD CONSTRAINT `chat_participants_chat_id_foreign` FOREIGN KEY (`chat_id`) REFERENCES `chat_rooms` (`chat_id`) ON DELETE CASCADE,
  ADD CONSTRAINT `chat_participants_updated_by_foreign` FOREIGN KEY (`updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `chat_participants_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `chat_passcodes`
--
ALTER TABLE `chat_passcodes`
  ADD CONSTRAINT `fk_chat_passcodes_created_by` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `fk_chat_passcodes_updated_by` FOREIGN KEY (`updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `fk_chat_passcodes_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `chat_requests`
--
ALTER TABLE `chat_requests`
  ADD CONSTRAINT `chat_requests_receiver_id_foreign` FOREIGN KEY (`receiver_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `chat_requests_sender_id_foreign` FOREIGN KEY (`sender_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `chat_requests_updated_by_foreign` FOREIGN KEY (`updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `chat_rooms`
--
ALTER TABLE `chat_rooms`
  ADD CONSTRAINT `chat_rooms_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `chat_rooms_updated_by_foreign` FOREIGN KEY (`updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `client_invoices`
--
ALTER TABLE `client_invoices`
  ADD CONSTRAINT `fk_inv_client` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE,
  ADD CONSTRAINT `fk_inv_currency` FOREIGN KEY (`currency_id`) REFERENCES `currencies` (`currency_id`) ON DELETE RESTRICT ON UPDATE CASCADE;

--
-- Constraints for table `client_invoice_disbursements`
--
ALTER TABLE `client_invoice_disbursements`
  ADD CONSTRAINT `fk_disb_invoice` FOREIGN KEY (`invoice_id`) REFERENCES `client_invoices` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `client_invoice_lines`
--
ALTER TABLE `client_invoice_lines`
  ADD CONSTRAINT `fk_cil_invoice` FOREIGN KEY (`invoice_id`) REFERENCES `client_invoices` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `client_invoice_taxes`
--
ALTER TABLE `client_invoice_taxes`
  ADD CONSTRAINT `fk_itax_invoice` FOREIGN KEY (`invoice_id`) REFERENCES `client_invoices` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `fk_itax_tax` FOREIGN KEY (`tax_id`) REFERENCES `taxes` (`tax_id`) ON DELETE RESTRICT ON UPDATE CASCADE;

--
-- Constraints for table `client_receipts`
--
ALTER TABLE `client_receipts`
  ADD CONSTRAINT `fk_rec_client` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE;

--
-- Constraints for table `client_receipt_lines`
--
ALTER TABLE `client_receipt_lines`
  ADD CONSTRAINT `fk_rline_invoice` FOREIGN KEY (`invoice_id`) REFERENCES `client_invoices` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE,
  ADD CONSTRAINT `fk_rline_receipt` FOREIGN KEY (`receipt_id`) REFERENCES `client_receipts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `currency_rates`
--
ALTER TABLE `currency_rates`
  ADD CONSTRAINT `fk_base_currency` FOREIGN KEY (`base_currency_id`) REFERENCES `currencies` (`currency_id`),
  ADD CONSTRAINT `fk_currency_rates_created_by` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  ADD CONSTRAINT `fk_currency_rates_updated_by` FOREIGN KEY (`updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  ADD CONSTRAINT `fk_target_currency` FOREIGN KEY (`target_currency_id`) REFERENCES `currencies` (`currency_id`);

--
-- Constraints for table `diaries`
--
ALTER TABLE `diaries`
  ADD CONSTRAINT `diaries_assigned_to_foreign` FOREIGN KEY (`assigned_to`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `diaries_category_id_foreign` FOREIGN KEY (`category_id`) REFERENCES `diary_categories` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `diaries_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `diaries_updated_by_foreign` FOREIGN KEY (`updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `diary_attachments`
--
ALTER TABLE `diary_attachments`
  ADD CONSTRAINT `diary_attachments_diary_id_foreign` FOREIGN KEY (`diary_id`) REFERENCES `diaries` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `diary_entry_tags`
--
ALTER TABLE `diary_entry_tags`
  ADD CONSTRAINT `diary_entry_tags_diary_id_foreign` FOREIGN KEY (`diary_id`) REFERENCES `diaries` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `diary_entry_tags_tag_id_foreign` FOREIGN KEY (`tag_id`) REFERENCES `diary_tags` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `diary_reminders`
--
ALTER TABLE `diary_reminders`
  ADD CONSTRAINT `diary_reminders_diary_id_foreign` FOREIGN KEY (`diary_id`) REFERENCES `diaries` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `general_journals`
--
ALTER TABLE `general_journals`
  ADD CONSTRAINT `fk_general_journals_currency` FOREIGN KEY (`currency_id`) REFERENCES `currencies` (`currency_id`) ON DELETE RESTRICT ON UPDATE CASCADE,
  ADD CONSTRAINT `fk_general_journals_subaccount` FOREIGN KEY (`account_id`) REFERENCES `general_ledger_subaccounts` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE;

--
-- Constraints for table `general_ledger_parent_accounts`
--
ALTER TABLE `general_ledger_parent_accounts`
  ADD CONSTRAINT `fk_glpa_account_type` FOREIGN KEY (`account_type_id`) REFERENCES `account_types` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE;

--
-- Constraints for table `general_ledger_subaccounts`
--
ALTER TABLE `general_ledger_subaccounts`
  ADD CONSTRAINT `fk_glsa_parent` FOREIGN KEY (`parent_id`) REFERENCES `general_ledger_parent_accounts` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE;

--
-- Constraints for table `group_permissions`
--
ALTER TABLE `group_permissions`
  ADD CONSTRAINT `fk_group_perm_created_by` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`),
  ADD CONSTRAINT `fk_group_perm_feature` FOREIGN KEY (`feature_id`) REFERENCES `permission_features` (`feature_id`) ON DELETE CASCADE,
  ADD CONSTRAINT `fk_group_perm_group` FOREIGN KEY (`group_id`) REFERENCES `user_groups` (`user_group_id`) ON DELETE CASCADE,
  ADD CONSTRAINT `fk_group_perm_updated_by` FOREIGN KEY (`updated_by`) REFERENCES `users` (`id`);

--
-- Constraints for table `lexa_chat_history`
--
ALTER TABLE `lexa_chat_history`
  ADD CONSTRAINT `fk_lex_chat_history_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `lexa_conversations`
--
ALTER TABLE `lexa_conversations`
  ADD CONSTRAINT `fk_lex_conversations_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `permission_audit_log`
--
ALTER TABLE `permission_audit_log`
  ADD CONSTRAINT `fk_audit_changed_by` FOREIGN KEY (`changed_by`) REFERENCES `users` (`id`),
  ADD CONSTRAINT `fk_audit_feature` FOREIGN KEY (`feature_id`) REFERENCES `permission_features` (`feature_id`);

--
-- Constraints for table `permission_features`
--
ALTER TABLE `permission_features`
  ADD CONSTRAINT `fk_feature_module` FOREIGN KEY (`module_id`) REFERENCES `permission_modules` (`module_id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `permission_modules`
--
ALTER TABLE `permission_modules`
  ADD CONSTRAINT `fk_module_parent` FOREIGN KEY (`parent_module_id`) REFERENCES `permission_modules` (`module_id`) ON DELETE SET NULL ON UPDATE CASCADE;

--
-- Constraints for table `supplier_invoice_lines`
--
ALTER TABLE `supplier_invoice_lines`
  ADD CONSTRAINT `supplier_invoice_lines_currency_id_foreign` FOREIGN KEY (`currency_id`) REFERENCES `currencies` (`currency_id`) ON DELETE SET NULL,
  ADD CONSTRAINT `supplier_invoice_lines_gl_subaccount_id_foreign` FOREIGN KEY (`gl_account_id`) REFERENCES `general_ledger_subaccounts` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  ADD CONSTRAINT `supplier_invoice_lines_invoice_id_foreign` FOREIGN KEY (`invoice_id`) REFERENCES `supplier_invoices` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `supplier_invoice_lines_tax_id_foreign` FOREIGN KEY (`tax_id`) REFERENCES `taxes` (`tax_id`) ON DELETE SET NULL;

--
-- Constraints for table `system_settings`
--
ALTER TABLE `system_settings`
  ADD CONSTRAINT `fk_system_settings_currency` FOREIGN KEY (`default_currency_id`) REFERENCES `currencies` (`currency_id`) ON DELETE SET NULL ON UPDATE CASCADE;

--
-- Constraints for table `tier_permissions`
--
ALTER TABLE `tier_permissions`
  ADD CONSTRAINT `fk_tier_perm_created_by` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`),
  ADD CONSTRAINT `fk_tier_perm_feature` FOREIGN KEY (`feature_id`) REFERENCES `permission_features` (`feature_id`) ON DELETE CASCADE,
  ADD CONSTRAINT `fk_tier_perm_tier` FOREIGN KEY (`tier_id`) REFERENCES `user_tiers` (`tier_id`) ON DELETE CASCADE,
  ADD CONSTRAINT `fk_tier_perm_updated_by` FOREIGN KEY (`updated_by`) REFERENCES `users` (`id`);

--
-- Constraints for table `uploaded_chat_files`
--
ALTER TABLE `uploaded_chat_files`
  ADD CONSTRAINT `uploaded_chat_files_chat_id_foreign` FOREIGN KEY (`chat_id`) REFERENCES `chat_rooms` (`chat_id`) ON DELETE CASCADE,
  ADD CONSTRAINT `uploaded_chat_files_updated_by_foreign` FOREIGN KEY (`updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `uploaded_chat_files_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `users`
--
ALTER TABLE `users`
  ADD CONSTRAINT `fk_users_group` FOREIGN KEY (`group_id`) REFERENCES `user_groups` (`user_group_id`),
  ADD CONSTRAINT `fk_users_tier` FOREIGN KEY (`tier_id`) REFERENCES `user_tiers` (`tier_id`);

--
-- Constraints for table `user_chat_settings`
--
ALTER TABLE `user_chat_settings`
  ADD CONSTRAINT `user_chat_settings_updated_by_foreign` FOREIGN KEY (`updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `user_chat_settings_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `user_permissions`
--
ALTER TABLE `user_permissions`
  ADD CONSTRAINT `fk_user_perm_created_by` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`),
  ADD CONSTRAINT `fk_user_perm_feature` FOREIGN KEY (`feature_id`) REFERENCES `permission_features` (`feature_id`) ON DELETE CASCADE,
  ADD CONSTRAINT `fk_user_perm_updated_by` FOREIGN KEY (`updated_by`) REFERENCES `users` (`id`),
  ADD CONSTRAINT `fk_user_perm_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `user_tiers`
--
ALTER TABLE `user_tiers`
  ADD CONSTRAINT `fk_user_tiers_user_group` FOREIGN KEY (`user_group_id`) REFERENCES `user_groups` (`user_group_id`) ON DELETE SET NULL ON UPDATE CASCADE;
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 */;
