-- phpMyAdmin SQL Dump
-- version 5.2.2
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Jun 19, 2026 at 01:50 AM
-- Server version: 10.11.17-MariaDB-cll-lve
-- PHP Version: 8.4.21

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: `jjbytesc_gpec`
--

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

--
-- Table structure for table `airtime`
--

CREATE TABLE `airtime` (
  `aId` int(100) NOT NULL,
  `aNetwork` varchar(10) NOT NULL,
  `aBuyDiscount` float NOT NULL DEFAULT 96,
  `aUserDiscount` float NOT NULL,
  `aAgentDiscount` float NOT NULL,
  `aVendorDiscount` float NOT NULL,
  `aType` varchar(15) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

--
-- Dumping data for table `airtime`
--

INSERT INTO `airtime` (`aId`, `aNetwork`, `aBuyDiscount`, `aUserDiscount`, `aAgentDiscount`, `aVendorDiscount`, `aType`) VALUES
(1, '1', 96.5, 99, 99, 99, 'VTU'),
(2, '2', 93, 99, 99, 99, 'VTU'),
(3, '3', 93, 99, 99.2, 99, 'VTU'),
(4, '4', 97, 99, 99, 99, 'VTU'),
(5, '1', 98, 99, 99, 99, 'Share And Sell'),
(6, '2', 98, 98, 98, 98, 'Share And Sell'),
(7, '3', 98, 99, 99, 99, 'Share And Sell'),
(8, '4', 98, 99, 99, 99, 'Share And Sell');

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

--
-- Table structure for table `airtimepin`
--

CREATE TABLE `airtimepin` (
  `aId` int(11) NOT NULL,
  `planid` varchar(10) NOT NULL,
  `aNetwork` varchar(10) NOT NULL,
  `planSize` varchar(10) NOT NULL,
  `aBuyPrice` float NOT NULL,
  `aUserPrice` float NOT NULL,
  `aAgentPrice` float NOT NULL,
  `aVendorPrice` float NOT NULL,
  `aDealerPrice` float NOT NULL,
  `loadpin` varchar(20) NOT NULL DEFAULT '*311*',
  `checkbalance` varchar(20) NOT NULL DEFAULT '*310#'
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

--
-- Dumping data for table `airtimepin`
--

INSERT INTO `airtimepin` (`aId`, `planid`, `aNetwork`, `planSize`, `aBuyPrice`, `aUserPrice`, `aAgentPrice`, `aVendorPrice`, `aDealerPrice`, `loadpin`, `checkbalance`) VALUES
(1, '1', '1', '100', 97.6, 98, 98, 98, 99, '*311*Pin#', '*310#'),
(2, '2', '1', '200', 195, 198, 198, 198, 197, '*311*', '*310#'),
(3, '3', '1', '500', 487.8, 495, 494, 492, 492, '*311*', '*310#'),
(4, '11', '1', '1000', 976, 994, 990, 985, 0, '*311*', '*310#'),
(145, '7', '3', '100', 97, 98, 98, 97.5, 0, '*311*pin#', '*310#'),
(146, '8', '3', '200', 195, 197, 196.8, 196.5, 0, '*311*pin#', '*310#'),
(147, '9', '3', '500', 492, 495, 492.6, 492.5, 0, '*310*Pin#', '*310#'),
(148, '13', '3', '1000', 970, 975, 973, 972, 0, '*311*Pin#', '*310#'),
(149, '14', '4', '100', 97, 98, 97.6, 97.5, 0, '*311*Pin#', '*310#'),
(150, '15', '4', '200', 196, 198, 197, 196.8, 0, '*311*Pin#', '*310#'),
(151, '16', '4', '500', 485, 490, 487, 486, 0, '*311*Pin#', '*310#'),
(152, '17', '4', '1000', 970, 990, 980, 975.5, 0, '*311*Pin#', '*310#'),
(153, '4', '2', '100', 97.5, 98, 97.5, 97.5, 0, '*311*Pin#', '*310#'),
(154, '5', '2', '200', 195, 197, 196, 196, 0, '*311*Pin #', '*310#'),
(155, '6', '2', '500', 485, 495, 492, 491, 0, '*311*Pin#', '*310#'),
(156, '12', '2', '1000', 985, 990, 988, 987, 0, '*311*Pin#', '*310#');

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

--
-- Table structure for table `airtimepinprice`
--

CREATE TABLE `airtimepinprice` (
  `aId` int(11) NOT NULL,
  `aNetwork` varchar(10) NOT NULL,
  `aUserDiscount` float NOT NULL,
  `aAgentDiscount` float NOT NULL,
  `aVendorDiscount` float NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

--
-- Dumping data for table `airtimepinprice`
--

INSERT INTO `airtimepinprice` (`aId`, `aNetwork`, `aUserDiscount`, `aAgentDiscount`, `aVendorDiscount`) VALUES
(1, '1', 99, 98, 97),
(2, '2', 99, 98, 97),
(3, '3', 99, 98, 97),
(4, '4', 99, 98, 97);

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

--
-- Table structure for table `airtimepinstock`
--

CREATE TABLE `airtimepinstock` (
  `tId` int(11) NOT NULL,
  `network` varchar(10) DEFAULT NULL,
  `amount` varchar(10) DEFAULT NULL,
  `serial` text NOT NULL,
  `tokens` text NOT NULL,
  `status` varchar(20) NOT NULL,
  `soldto` varchar(200) DEFAULT NULL,
  `date` datetime NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

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

--
-- Table structure for table `airtimetokens`
--

CREATE TABLE `airtimetokens` (
  `tId` int(11) NOT NULL,
  `sId` int(11) NOT NULL,
  `tRef` varchar(255) NOT NULL,
  `business` varchar(30) NOT NULL,
  `network` varchar(10) DEFAULT NULL,
  `amount` varchar(10) DEFAULT NULL,
  `loadpin` varchar(30) DEFAULT NULL,
  `checkbalance` varchar(30) DEFAULT NULL,
  `quantity` int(11) NOT NULL,
  `serial` text NOT NULL,
  `tokens` text NOT NULL,
  `date` datetime NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

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

--
-- Table structure for table `alphatopupprice`
--

CREATE TABLE `alphatopupprice` (
  `alphaId` int(11) NOT NULL,
  `buyingPrice` int(11) NOT NULL,
  `sellingPrice` int(11) NOT NULL,
  `agent` int(11) NOT NULL,
  `vendor` int(11) NOT NULL,
  `dPosted` datetime NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

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

--
-- Table structure for table `apiconfigs`
--

CREATE TABLE `apiconfigs` (
  `aId` int(11) NOT NULL,
  `name` varchar(30) NOT NULL,
  `value` varchar(2000) DEFAULT NULL,
  `updateOn` datetime(6) NOT NULL DEFAULT current_timestamp(6)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

--
-- Dumping data for table `apiconfigs`
--

INSERT INTO `apiconfigs` (`aId`, `name`, `value`, `updateOn`) VALUES
(1, 'monifyCharges', NULL, '2025-01-05 19:51:50.340971'),
(2, 'monifyApi', NULL, '2025-01-05 19:51:50.340971'),
(3, 'monifySecrete', NULL, '2025-01-05 19:51:50.340971'),
(4, 'monifyContract', NULL, '2025-01-05 19:51:50.340971'),
(5, 'monifyWeStatus', NULL, '2025-01-05 19:51:50.340971'),
(6, 'monifyMoStatus', NULL, '2025-01-05 19:51:50.340971'),
(7, 'monifyFeStatus', NULL, '2025-01-05 19:51:50.340971'),
(8, 'monifySaStatus', NULL, '2025-01-05 19:51:50.340971'),
(9, 'monifyStatus', NULL, '2025-01-05 19:51:50.340971'),
(10, 'kudaEmail', NULL, '2025-01-05 19:51:50.340971'),
(11, 'kudaApi', NULL, '2025-01-05 19:51:50.340971'),
(12, 'kudaWebhookUser', NULL, '2025-01-05 19:51:50.340971'),
(13, 'mtnVtuKey', NULL, '2025-01-05 19:51:50.340971'),
(14, 'mtnVtuProvider', NULL, '2025-01-05 19:51:50.340971'),
(15, 'mtnSharesellKey', NULL, '2025-01-05 19:51:50.340971'),
(16, 'mtnSharesellProvider', NULL, '2025-01-05 19:51:50.340971'),
(17, 'airtelVtuKey', NULL, '2025-01-05 19:51:50.340971'),
(18, 'airtelVtuProvider', NULL, '2025-01-05 19:51:50.340971'),
(19, 'airtelSharesellKey', NULL, '2025-01-05 19:51:50.340971'),
(20, 'airtelSharesellProvider', NULL, '2025-01-05 19:51:50.340971'),
(21, 'gloVtuKey', NULL, '2025-01-05 19:51:50.340971'),
(22, 'gloVtuProvider', NULL, '2025-01-05 19:51:50.340971'),
(23, 'gloSharesellKey', NULL, '2025-01-05 19:51:50.340971'),
(24, 'gloSharesellProvider', NULL, '2025-01-05 19:51:50.340971'),
(25, '9mobileVtuKey', NULL, '2025-01-05 19:51:50.340971'),
(26, '9mobileVtuProvider', NULL, '2025-01-05 19:51:50.340971'),
(27, '9mobileSharesellKey', NULL, '2025-01-05 19:51:50.340971'),
(28, '9mobileSharesellProvider', NULL, '2025-01-05 19:51:50.340971'),
(29, 'mtnSmeApi', NULL, '2025-01-05 19:51:50.340971'),
(30, 'mtnSmeProvider', NULL, '2025-01-05 19:51:50.340971'),
(31, 'mtnGiftingApi', NULL, '2025-01-05 19:51:50.340971'),
(32, 'mtnGiftingProvider', NULL, '2025-01-05 19:51:50.340971'),
(33, 'mtnCorporateApi', NULL, '2025-01-05 19:51:50.340971'),
(34, 'mtnCorporateProvider', NULL, '2025-01-05 19:51:50.340971'),
(35, 'airtelSmeApi', NULL, '2025-01-05 19:51:50.340971'),
(36, 'airtelSmeProvider', NULL, '2025-01-05 19:51:50.340971'),
(37, 'airtelGiftingApi', NULL, '2025-01-05 19:51:50.340971'),
(38, 'airtelGiftingProvider', NULL, '2025-01-05 19:51:50.340971'),
(39, 'airtelCorporateApi', NULL, '2025-01-05 19:51:50.340971'),
(40, 'airtelCorporateProvider', NULL, '2025-01-05 19:51:50.340971'),
(41, 'gloSmeApi', NULL, '2025-01-05 19:51:50.340971'),
(42, 'gloSmeProvider', NULL, '2025-01-05 19:51:50.340971'),
(43, 'gloGiftingApi', NULL, '2025-01-05 19:51:50.340971'),
(44, 'gloGiftingProvider', NULL, '2025-01-05 19:51:50.340971'),
(45, 'gloCorporateApi', NULL, '2025-01-05 19:51:50.340971'),
(46, 'gloCorporateProvider', NULL, '2025-01-05 19:51:50.340971'),
(47, '9mobileSmeApi', NULL, '2025-01-05 19:51:50.340971'),
(48, '9mobileSmeProvider', NULL, '2025-01-05 19:51:50.340971'),
(49, '9mobileGiftingApi', NULL, '2025-01-05 19:51:50.340971'),
(50, '9mobileGiftingProvider', NULL, '2025-01-05 19:51:50.340971'),
(51, '9mobileCorporateApi', NULL, '2025-01-05 19:51:50.340971'),
(52, '9mobileCorporateProvider', NULL, '2025-01-05 19:51:50.340971'),
(53, 'cableVerificationApi', NULL, '2025-01-05 19:51:50.340971'),
(54, 'cableVerificationProvider', NULL, '2025-01-05 19:51:50.340971'),
(55, 'cableApi', NULL, '2025-01-05 19:51:50.340971'),
(56, 'cableProvider', NULL, '2025-01-05 19:51:50.340971'),
(57, 'meterVerificationApi', NULL, '2025-01-05 19:51:50.340971'),
(58, 'meterVerificationProvider', NULL, '2025-01-05 19:51:50.340971'),
(59, 'meterApi', NULL, '2025-01-05 19:51:50.340971'),
(60, 'meterProvider', NULL, '2025-01-05 19:51:50.340971'),
(61, 'examApi', NULL, '2025-01-05 19:51:50.340971'),
(62, 'examProvider', NULL, '2025-01-05 19:51:50.340971'),
(63, 'rechargePinApi', NULL, '2025-01-05 19:51:50.340971'),
(64, 'rechargePinProvider', NULL, '2025-01-05 19:51:50.340971'),
(65, 'walletOneApi', NULL, '2025-01-05 19:51:50.340971'),
(66, 'walletOneProvider', NULL, '2025-01-05 19:51:50.340971'),
(67, 'walletOneProviderName', NULL, '2025-01-05 19:51:50.340971'),
(68, 'walletTwoApi', NULL, '2025-01-05 19:51:50.340971'),
(69, 'walletTwoProvider', NULL, '2025-01-05 19:51:50.340971'),
(70, 'walletTwoProviderName', NULL, '2025-01-05 19:51:50.340971'),
(71, 'walletThreeApi', NULL, '2025-01-05 19:51:50.340971'),
(72, 'walletThreeProvider', NULL, '2025-01-05 19:51:50.340971'),
(73, 'walletThreeProviderName', NULL, '2025-01-05 19:51:50.340971'),
(74, 'walletFourApi', NULL, '2025-01-05 19:51:50.340971'),
(75, 'walletFourProvider', NULL, '2025-01-05 19:51:50.340971'),
(76, 'walletFourProviderName', NULL, '2025-01-05 19:51:50.340971'),
(77, 'walletFiveApi', NULL, '2025-01-05 19:51:50.340971'),
(78, 'walletFiveProvider', NULL, '2025-01-05 19:51:50.340971'),
(79, 'walletFiveProviderName', NULL, '2025-01-05 19:51:50.340971'),
(80, 'walletSixApi', NULL, '2025-01-05 19:51:50.340971'),
(81, 'walletSixProvider', NULL, '2025-01-05 19:51:50.340971'),
(82, 'walletSixProviderName', NULL, '2025-01-05 19:51:50.340971'),
(83, 'airtime2cashstatus', NULL, '2025-01-05 19:51:50.340971'),
(84, 'airtime2cashmtnno', NULL, '2025-01-05 19:51:50.340971'),
(85, 'airtime2cashmtnrate', NULL, '2025-01-05 19:51:50.340971'),
(86, 'airtime2cashairtelno', NULL, '2025-01-05 19:51:50.340971'),
(87, 'airtime2cashairtelrate', NULL, '2025-01-05 19:51:50.340971'),
(88, 'airtime2cashglono', NULL, '2025-01-05 19:51:50.340971'),
(89, 'airtime2cashglorate', NULL, '2025-01-05 19:51:50.340971'),
(90, 'airtime2cash9mobilerate', NULL, '2025-01-05 19:51:50.340971'),
(91, 'asfiyApi', NULL, '2025-01-05 19:51:50.340971'),
(92, 'asfiyWebhook', NULL, '2025-01-05 19:51:50.340971'),
(93, 'asfiyChargesType', NULL, '2025-01-05 19:51:50.340971'),
(94, 'asfiyCharges', NULL, '2025-01-05 19:51:50.340971'),
(95, 'asfiyStatus', NULL, '2025-01-05 19:51:50.340971'),
(96, 'kudaWebhookPass', NULL, '2025-01-05 19:51:50.340971'),
(97, 'kudaCharges', NULL, '2025-01-05 19:51:50.340971'),
(98, 'kudaStatus', NULL, '2025-01-05 19:51:50.340971'),
(99, 'kudaChargesType', NULL, '2025-01-05 19:51:50.340971'),
(100, 'monifyGtStatus', NULL, '2025-01-05 19:51:50.340971'),
(101, 'payvesselBusinessId', NULL, '2025-01-05 19:51:50.340971'),
(102, 'payvesselApiKey', NULL, '2025-01-05 19:51:50.340971'),
(103, 'payvesselSecret', NULL, '2025-01-05 19:51:50.340971'),
(104, 'payvesselChargesType', NULL, '2025-01-05 19:51:50.340971'),
(105, 'payvesselStatus', NULL, '2025-01-05 19:51:50.340971'),
(106, 'payvesselCharges', NULL, '2025-01-05 19:51:50.340971'),
(125, 'billstackPalmpayStatus', NULL, '2024-05-23 20:32:28.000000'),
(126, 'billstack9psbStatus', NULL, '2024-05-23 20:32:28.000000'),
(127, 'strowalletPublicKey', NULL, '2024-05-23 20:32:28.000000'),
(128, 'strowalletWebhookUrl', NULL, '2024-05-23 20:32:28.000000'),
(129, 'billstackBanklyStatus', NULL, '2024-05-23 20:32:28.000000'),
(130, 'billstackSafehavenStatus', NULL, '2024-05-23 20:32:28.000000'),
(131, 'billstackProvidusStatus', NULL, '2024-05-23 20:32:28.000000'),
(132, 'PaymentPointPalmpayStatus', NULL, '2024-05-23 20:32:28.000000'),
(133, 'strowalletCharges', NULL, '2024-05-23 20:32:28.000000'),
(134, 'strowalletChargesType', NULL, '2024-05-23 20:32:28.000000'),
(135, 'aspfiyPalmpayStatus', NULL, '2024-05-23 20:32:28.000000'),
(136, 'aspfiySafehavenStatus', NULL, '2024-05-23 20:32:28.000000'),
(137, 'aspfiyPagaStatus', NULL, '2024-05-23 20:32:28.000000'),
(138, 'paymentPointBusinessId', NULL, '2024-05-23 20:32:28.000000'),
(139, 'paymentPointApiKey', NULL, '2024-05-23 20:32:28.000000'),
(140, 'paymentPointChargesType', NULL, '2024-05-23 20:32:28.000000'),
(141, 'paymentPointCharges', NULL, '2024-05-23 20:32:28.000000'),
(142, 'paymentPointStatus', NULL, '2024-05-23 20:32:28.000000'),
(143, 'paymentPointSecretKey', NULL, '2024-05-23 20:32:28.000000'),
(144, 'strowalletStatus', NULL, '2024-12-09 17:39:32.000000'),
(145, 'pagaStatus', NULL, '2024-12-09 17:39:32.000000'),
(146, 'banklyStatus', NULL, '2024-12-09 17:39:32.000000'),
(147, 'safehavenStatus', NULL, '2024-12-09 17:39:32.000000'),
(148, 'strowalletBanklyUrl', NULL, '2024-12-17 07:07:15.000000'),
(149, 'strowalletSafehavenUrl', NULL, '2024-12-17 07:07:15.000000'),
(150, 'strowalletPagaUrl', NULL, '2024-12-17 07:07:15.000000'),
(151, 'bulkSMSProvider', NULL, '2024-05-23 20:32:28.000000'),
(152, 'bulkSMSApi', NULL, '2024-05-23 20:32:28.000000'),
(153, 'monifyCardStatus', NULL, '2024-05-23 20:32:28.000000'),
(154, '9mobileVtuProvider', NULL, '2025-01-05 20:06:13.422237'),
(155, 'mtnSme2Api', NULL, '2025-01-05 20:06:13.422237'),
(156, 'mtnSme2Provider', NULL, '2025-01-05 20:06:13.422237'),
(157, 'gloSme2Api', NULL, '2025-01-05 20:06:13.422237'),
(158, 'gloSme2Provider', NULL, '2025-01-05 20:06:13.422237'),
(159, 'airtelSme2Api', NULL, '2025-01-05 20:06:13.422237'),
(160, 'airtelSme2Provider', NULL, '2025-01-05 20:06:13.422237'),
(161, '9mobileSme2Api', NULL, '2025-01-05 20:06:13.422237'),
(162, '9mobileSme2Provider', NULL, '2025-01-05 20:06:13.422237'),
(163, 'rechargePinMethod', NULL, '2025-01-05 20:06:13.422237'),
(164, 'dataPinMethod', NULL, '2025-01-05 20:06:13.422237'),
(165, 'billstackCharges', NULL, '2025-01-05 20:06:13.422237'),
(166, 'billstackSecret', NULL, '2025-01-05 20:06:13.422237'),
(167, 'billstackStatus', NULL, '2025-01-05 20:06:13.422237'),
(168, 'billstackChargesType', NULL, '2025-01-05 20:06:13.422237'),
(169, 'mtnCouponProvider', NULL, '2025-01-05 20:06:13.422237'),
(170, 'mtnCouponApi', NULL, '2025-01-05 20:06:13.422237'),
(171, 'gloCouponProvider', NULL, '2025-01-05 20:06:13.422237'),
(172, 'gloCouponApi', NULL, '2025-01-05 20:06:13.422237'),
(173, 'airtelCouponProvider', NULL, '2025-01-05 20:06:13.422237'),
(174, 'airtelCouponApi', NULL, '2025-01-05 20:06:13.422237'),
(175, '9mobileCouponProvider', NULL, '2025-01-05 20:06:13.422237'),
(176, '9mobileCouponApi', NULL, '2025-01-05 20:06:13.422237'),
(177, 'mtndataProvider', NULL, '2025-01-05 20:06:13.422237'),
(178, 'mtndataApi', NULL, '2025-01-05 20:06:13.422237'),
(179, 'smsSenderId', NULL, '2025-01-05 19:51:50.340971'),
(180, 'smsAccountEmail', NULL, '2025-01-05 19:51:50.340971'),
(181, 'smsApiKey', NULL, '2024-05-23 20:32:28.000000'),
(190, 'cardStatus', NULL, '2024-05-23 20:32:28.000000'),
(191, 'cardCharges', NULL, '2024-05-23 20:32:28.000000'),
(192, 'dollarRate', NULL, '2024-05-23 20:32:28.000000'),
(193, 'cardkay', NULL, '2024-05-23 15:21:09.000000'),
(194, 'vpayKey', NULL, '2024-05-23 15:21:09.000000'),
(195, 'vpayEmail', NULL, '2024-05-23 15:21:09.000000'),
(196, 'vpayPass', NULL, '2024-05-23 15:21:09.000000'),
(197, 'vpayCharges', NULL, '2024-05-23 15:21:09.000000'),
(198, 'vpayToken', NULL, '2025-01-05 23:46:25.000000'),
(199, 'vpayStatus', NULL, '2024-05-23 15:21:09.000000'),
(200, 'CACcharge1', NULL, '2024-05-23 15:21:09.000000'),
(201, 'CACcharge2', NULL, '2024-05-23 15:21:09.000000'),
(202, 'CACstatus', NULL, '2024-05-23 15:21:09.000000'),
(203, 'cashback2walletstatus', NULL, '2025-01-05 19:51:50.340971'),
(206, 'topupmateApiKey', NULL, '2026-04-15 16:35:43.813137'),
(207, 'topupmateApiSecret', NULL, '2026-04-15 16:35:43.824832');

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

--
-- Table structure for table `apilinks`
--

CREATE TABLE `apilinks` (
  `aId` int(11) NOT NULL,
  `name` varchar(30) NOT NULL,
  `value` varchar(100) DEFAULT NULL,
  `type` varchar(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

--
-- Dumping data for table `apilinks`
--

INSERT INTO `apilinks` (`aId`, `name`, `value`, `type`) VALUES
(111, 'SMEAPI', 'https://smeapi.com.ng/api/user/', 'Wallet'),
(112, 'SMEAPI', 'https://smeapi.com.ng/api/airtime/', 'Airtime'),
(113, 'SMEAPI', 'https://smeapi.com.ng/api/data/', 'Data'),
(114, 'myaabaxtech', 'https://myaabaxztech.com/api/user/', 'Wallet'),
(115, 'myaabaxztech', 'https://myaabaxztech.com/api/airtime/', 'Airtime'),
(116, 'myaabaxztech', 'https://myaabaxztech.com/api/data/', 'Data');

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

--
-- Table structure for table `beneficiary`
--

CREATE TABLE `beneficiary` (
  `id` int(11) NOT NULL,
  `sId` varchar(255) DEFAULT NULL,
  `name` varchar(255) DEFAULT NULL,
  `phone` varchar(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

--
-- Dumping data for table `beneficiary`
--

INSERT INTO `beneficiary` (`id`, `sId`, `name`, `phone`) VALUES
(1, '3', '7ujjj', '9988'),
(2, '23', 'Hlf', '08059911578');

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

--
-- Table structure for table `BlackIP`
--

CREATE TABLE `BlackIP` (
  `id` int(11) UNSIGNED NOT NULL,
  `ip_address` varchar(45) NOT NULL,
  `date_blocked` datetime DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

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

--
-- Table structure for table `blacklist`
--

CREATE TABLE `blacklist` (
  `id` int(11) NOT NULL,
  `bPhone` varchar(50) NOT NULL,
  `date_added` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

--
-- Dumping data for table `blacklist`
--

INSERT INTO `blacklist` (`id`, `bPhone`, `date_added`) VALUES
(2, '08122222222', NULL),
(4, '08068112413', NULL),
(5, '08147302304', NULL),
(6, '07039899498', NULL),
(7, '09031302879', NULL),
(8, '09068549724', NULL),
(9, '08142700775', NULL),
(10, '09033070595', NULL),
(11, '08111116335', NULL),
(12, '07061983004', NULL),
(13, '08162704634', NULL),
(14, '08145599861', NULL),
(16, '09136374844', NULL),
(17, '09029163515', NULL),
(18, '07047358763', NULL),
(19, '08167959649', NULL),
(20, '08030608854', NULL),
(21, '09134755186', NULL),
(22, '08146439413', NULL),
(23, '09031399710', NULL),
(24, '09036391453', NULL),
(25, '07084143743', NULL);

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

--
-- Table structure for table `bulksms`
--

CREATE TABLE `bulksms` (
  `id` int(11) NOT NULL,
  `sId` int(11) NOT NULL,
  `tRef` varchar(255) NOT NULL,
  `sender_name` varchar(100) NOT NULL,
  `phonenumbers` text NOT NULL,
  `message` text NOT NULL,
  `total_correct_number` int(11) NOT NULL,
  `total_wrong_number` int(11) NOT NULL,
  `total_number` int(11) NOT NULL,
  `created_at` datetime DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

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

--
-- Table structure for table `cableid`
--

CREATE TABLE `cableid` (
  `cId` int(11) NOT NULL,
  `cableid` varchar(10) DEFAULT NULL,
  `provider` varchar(10) NOT NULL,
  `providerStatus` varchar(10) NOT NULL DEFAULT 'On'
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

--
-- Dumping data for table `cableid`
--

INSERT INTO `cableid` (`cId`, `cableid`, `provider`, `providerStatus`) VALUES
(1, '1', 'GOTV', 'On'),
(2, '2', 'DSTV', 'On'),
(3, '3', 'STARTIMES', 'On');

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

--
-- Table structure for table `cableplans`
--

CREATE TABLE `cableplans` (
  `cpId` int(11) NOT NULL,
  `name` varchar(255) NOT NULL,
  `price` varchar(255) NOT NULL,
  `userprice` varchar(255) NOT NULL,
  `agentprice` varchar(255) NOT NULL,
  `vendorprice` varchar(255) NOT NULL,
  `planid` varchar(255) NOT NULL,
  `type` varchar(255) DEFAULT NULL,
  `cableprovider` tinyint(4) NOT NULL,
  `day` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

--
-- Dumping data for table `cableplans`
--

INSERT INTO `cableplans` (`cpId`, `name`, `price`, `userprice`, `agentprice`, `vendorprice`, `planid`, `type`, `cableprovider`, `day`) VALUES
(1, 'MAX', '4850', '4850', '4850', '2850', '2', NULL, 1, '30'),
(2, 'JINJA', '2250', '2250', '2250', '2250', '16', NULL, 1, '30'),
(3, 'JOLLI', '3300', '3300', '3300', '3300', '17', NULL, 1, '30'),
(4, 'SMALLIE', '1100', '1100', '1100', '1100', '18', NULL, 1, '30'),
(5, 'Supa', '6500', '6500', '6500', '6500', '47', NULL, 1, '30'),
(6, 'Yanga', '3500', '3500', '3500', '3500', '6', NULL, 2, '30'),
(7, 'Compact', '9000', '9000', '9000', '9000', '7', NULL, 2, '30'),
(8, 'Compact Plus', '16600', '16600', '16600', '16600', '8', NULL, 2, '30'),
(9, 'Confam', '6200', '6200', '6200', '6200', '19', NULL, 2, '30');

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

--
-- Table structure for table `CAC`
--

CREATE TABLE `CAC` (
  `id` int(11) NOT NULL,
  `certType` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL,
  `comp_name` varchar(255) NOT NULL,
  `alt_comp_name` varchar(255) DEFAULT NULL,
  `share_cap` decimal(15,2) NOT NULL,
  `comp_addr` varchar(255) NOT NULL,
  `res_addr` varchar(255) NOT NULL,
  `bus_nature` varchar(255) NOT NULL,
  `dir_id_card` varchar(255) DEFAULT NULL,
  `passport_photo` varchar(255) DEFAULT NULL,
  `phone_num` varchar(15) NOT NULL,
  `status` varchar(50) DEFAULT NULL,
  `sId` int(11) DEFAULT NULL,
  `submit_date` date DEFAULT NULL,
  `note` varchar(255) NOT NULL DEFAULT 'Your CAC certificate will be ready in 3 to 14 days. The process will be sent to your email.'
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

--
-- Dumping data for table `CAC`
--

INSERT INTO `CAC` (`id`, `certType`, `email`, `comp_name`, `alt_comp_name`, `share_cap`, `comp_addr`, `res_addr`, `bus_nature`, `dir_id_card`, `passport_photo`, `phone_num`, `status`, `sId`, `submit_date`, `note`) VALUES
(4, 'biz', '', 'Kiru online', 'Kiru online', 0.00, 'Kiru qwatas', 'Qwatas', 'Kiru online', '/assets/userImage/adminicon2.png', '/assets/userImage/cac.png', '07026417709', 'Approved', 1, '2024-08-23', 'Hi Messenge me in WhatsApp 07026417709'),
(5, 'biz', '', 'VTU TELECOM ', 'VTU TELECOM ', 0.00, 'KIRU LGA', 'KIRU Quarters ', 'VTU Business ', '/assets/userImage/IMG-20240817-WA0030.jpg', '/assets/userImage/IMG-20240822-WA0051.jpg', '07026417709', 'Approved', 1, '2024-08-25', '');

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

--
-- Table structure for table `cashback`
--

CREATE TABLE `cashback` (
  `id` int(11) NOT NULL,
  `Airtime` int(11) DEFAULT 2,
  `Data` int(11) DEFAULT 2,
  `Cable` int(11) DEFAULT 2,
  `Electricity` int(11) DEFAULT 2,
  `Exam` int(11) DEFAULT 2,
  `WalletFunding` int(11) DEFAULT 2
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

--
-- Dumping data for table `cashback`
--

INSERT INTO `cashback` (`id`, `Airtime`, `Data`, `Cable`, `Electricity`, `Exam`, `WalletFunding`) VALUES
(1, 0, 0, 0, 0, 0, 0);

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

--
-- Table structure for table `contact`
--

CREATE TABLE `contact` (
  `msgId` int(11) NOT NULL,
  `sId` int(11) NOT NULL,
  `name` varchar(100) NOT NULL,
  `contact` varchar(200) NOT NULL,
  `subject` varchar(200) NOT NULL,
  `message` text NOT NULL,
  `dPosted` datetime NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

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

--
-- Table structure for table `crypto`
--

CREATE TABLE `crypto` (
  `type` varchar(255) NOT NULL,
  `network` tinyint(4) NOT NULL,
  `agentrate` varchar(255) NOT NULL,
  `userrate` varchar(255) NOT NULL,
  `vendorrate` varchar(255) NOT NULL,
  `price` varchar(255) NOT NULL,
  `name` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

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

--
-- Table structure for table `datapins`
--

CREATE TABLE `datapins` (
  `dpId` int(11) NOT NULL,
  `name` varchar(255) NOT NULL,
  `price` varchar(255) NOT NULL,
  `userprice` varchar(255) NOT NULL,
  `agentprice` varchar(255) NOT NULL,
  `vendorprice` varchar(255) NOT NULL,
  `planid` varchar(255) NOT NULL,
  `type` varchar(255) DEFAULT NULL,
  `datanetwork` tinyint(4) NOT NULL,
  `day` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

--
-- Dumping data for table `datapins`
--

INSERT INTO `datapins` (`dpId`, `name`, `price`, `userprice`, `agentprice`, `vendorprice`, `planid`, `type`, `datanetwork`, `day`) VALUES
(1, '1.5GB', '309', '320', '300', '300', '1', 'Corporate', 1, '30'),
(2, '500 MB', '108', '120', '120', '120', '2', 'SME', 1, '30'),
(3, '1GB', '215', '220', '220', '220', '3', 'SME', 1, '30'),
(4, '2GB', '430', '450', '450', '450', '4', 'SME', 1, '30'),
(5, '3GB', '645', '650', '650', '650', '5', 'SME', 1, '30'),
(6, '5GB', '1075', '1090', '1090', '1090', '6', 'SME', 1, '30'),
(7, '10GB', '2150', '2200', '2200', '2200', '7', 'SME', 1, '30'),
(8, '500 MB', '100', '120', '120', '120', '8', 'Corporate', 2, '30'),
(9, '1GB', '200', '220', '220', '220', '9', 'Corporate', 2, '30'),
(10, '2GB', '400', '420', '420', '420', '10', 'Corporate', 2, '30'),
(11, '5GB', '1000', '1200', '1200', '1200', '11', 'Corporate', 2, '30'),
(12, '10GB', '2000', '2200', '2200', '2200', '12', 'Corporate', 2, '30');

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

--
-- Table structure for table `dataplans`
--

CREATE TABLE `dataplans` (
  `pId` int(11) NOT NULL,
  `name` varchar(255) NOT NULL,
  `price` varchar(255) NOT NULL,
  `userprice` varchar(255) NOT NULL,
  `agentprice` varchar(255) NOT NULL,
  `vendorprice` varchar(255) NOT NULL,
  `planid` varchar(255) NOT NULL,
  `type` varchar(255) DEFAULT NULL,
  `datanetwork` tinyint(4) NOT NULL,
  `day` varchar(255) NOT NULL,
  `apiprice` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

--
-- Dumping data for table `dataplans`
--

INSERT INTO `dataplans` (`pId`, `name`, `price`, `userprice`, `agentprice`, `vendorprice`, `planid`, `type`, `datanetwork`, `day`, `apiprice`) VALUES
(1, '500MB 7days', '260', '280', '280', '280', '1', 'SME', 1, '7days', ''),
(2, '1GB 7days', '375', '395', '395', '395', '2', 'SME', 1, '7days', ''),
(3, '2GB 7days', '730', '770', '770', '770', '3', 'SME', 1, '7days', ''),
(4, '3GB 7days', '990', '1040', '1040', '1040', '4', 'SME', 1, '7days', ''),
(5, '1GB 30days', '490', '520', '520', '520', '6', 'SME', 1, '30days', ''),
(6, '3GB 30days', '1100', '1150', '1150', '1150', '7', 'SME', 1, '30days', ''),
(7, '2GB 30days', '805', '850', '850', '850', '8', 'Corporate', 1, '30days', ''),
(8, '1GB 1day', '250', '270', '270', '270', '20', 'Gifting', 1, '1day', ''),
(9, '2.5GB 1day', '550', '580', '580', '580', '21', 'Gifting', 1, '1day', ''),
(10, '5GB 30days', '1290', '1340', '1340', '1340', '40', 'Corporate', 1, '30days', ''),
(11, '2GB 1day', '500', '530', '530', '530', '41', 'Corporate', 1, '1day', ''),
(12, '3GB 1day', '730', '780', '780', '780', '42', 'Gifting', 1, '1day', ''),
(13, '5GB 14days', '1100', '1150', '1150', '1150', '43', 'SME2', 1, '14days', ''),
(14, '75MB 1day', '78', '98', '98', '98', '60', 'SME', 4, '1day', ''),
(15, '100MB 1day', '99', '120', '120', '120', '61', 'SME', 4, '1day', ''),
(16, '110MB 1day', '99', '120', '120', '120', '62', 'SME', 4, '1day', ''),
(17, '150MB 1day', '60', '110', '110', '110', '63', 'SME', 4, '1day', ''),
(18, '230MB 2days', '192', '242', '242', '242', '64', 'SME', 4, '2days', ''),
(19, '230MB 2days', '192', '242', '242', '242', '65', 'SME', 4, '2days', ''),
(20, '300MB 2days', '120', '140', '140', '140', '66', 'SME', 4, '2days', ''),
(21, '300MB 2days', '285', '335', '335', '335', '67', 'SME', 4, '2days', ''),
(22, '500MB 7days', '470', '490', '490', '490', '68', 'Corporate', 4, '7days', ''),
(23, '500MB 7days', '470', '490', '490', '490', '69', 'Gifting', 4, '7days', ''),
(24, '600MB 1day', '225', '240', '240', '240', '70', 'SME', 4, '1day', ''),
(25, '1GB 3days', '284', '334', '334', '334', '71', 'SME', 4, '3days', ''),
(26, '1GB 3days', '284', '334', '334', '334', '72', 'SME', 4, '3days', ''),
(27, '1GB 1day', '289', '339', '339', '339', '73', 'SME', 4, '1day', ''),
(28, '1GB 1day', '315', '330', '330', '330', '74', 'SME2', 4, '1day', ''),
(29, '1GB 7days', '749', '780', '780', '780', '75', 'Corporate', 4, '7days', ''),
(30, '1.5GB 1day', '438', '468', '468', '468', '76', 'SME2', 4, '1day', ''),
(31, '1.5GB 7days', '493', '543', '543', '543', '77', 'Corporate', 4, '7days', ''),
(32, '1.5GB 7days', '828', '868', '868', '868', '78', 'Gifting', 4, '7days', ''),
(33, '2GB 2days', '650', '700', '700', '700', '79', 'SME', 4, '2days', ''),
(34, '2GB 30days', '1405', '1455', '1455', '1455', '80', 'SME', 4, '30days', ''),
(35, '3GB 2days', '713', '763', '763', '763', '81', 'SME', 4, '2days', ''),
(36, '3GB 2days', '713', '763', '763', '763', '82', 'SME', 4, '2days', ''),
(37, '3GB 2days', '795', '845', '845', '845', '83', 'SME', 4, '2days', ''),
(38, '3GB 7days', '1099', '1149', '1149', '1149', '84', 'Corporate', 4, '7days', ''),
(39, '3GB 30days', '1875', '1925', '1925', '1925', '85', 'Corporate', 4, '30days', ''),
(40, '4GB 7days', '1415', '1465', '1465', '1465', '86', 'Corporate', 4, '7days', ''),
(41, '4GB 30days', '2345', '2395', '2395', '2395', '87', 'Gifting', 4, '30days', ''),
(42, '4GB 30days', '2345', '2395', '2395', '2395', '88', 'SME', 4, '30days', ''),
(43, '6GB 7days', '2355', '2405', '2405', '2405', '89', 'Corporate', 4, '7days', ''),
(44, '6GB 7days', '2355', '2405', '2405', '2405', '90', 'SME', 4, '7days', ''),
(45, '8GB 30days', '2830', '2880', '2880', '2880', '91', 'SME', 4, '30days', ''),
(46, '8GB 30days', '2830', '2880', '2880', '2880', '92', 'SME', 4, '30days', ''),
(47, '10GB 7days', '2840', '2890', '2890', '2890', '93', 'SME', 4, '7days', ''),
(48, '10GB 30days', '3100', '3150', '3150', '3150', '94', 'SME', 4, '30days', ''),
(49, '10GB 30days', '3770', '3820', '3820', '3820', '95', 'SME', 4, '30days', ''),
(50, '13GB 30days', '4715', '4765', '4765', '4765', '96', 'SME', 4, '30days', ''),
(51, '13GB 30days', '4715', '4765', '4765', '4765', '97', 'SME', 4, '30days', ''),
(52, '18GB 7days', '4940', '4990', '4990', '4990', '98', 'SME', 4, '7days', ''),
(53, '18GB 7days', '4940', '4990', '4990', '4990', '99', 'SME', 4, '7days', ''),
(54, '18GB 30days', '5670', '5720', '5720', '5720', '100', 'SME', 4, '30days', ''),
(55, '18GB 30days', '5670', '5720', '5720', '5720', '101', 'SME', 4, '30days', ''),
(56, '25GB 30days', '7565', '7615', '7615', '7615', '102', 'SME', 4, '30days', ''),
(57, '25GB 30days', '7885', '7935', '7935', '7935', '103', 'SME', 4, '30days', ''),
(58, '35GB 30days', '9875', '9925', '9925', '9925', '104', 'SME', 4, '30days', ''),
(59, '35GB 30days', '9875', '9925', '9925', '9925', '105', 'SME', 4, '30days', ''),
(60, '60GB 30days', '14850', '14900', '14900', '14900', '106', 'SME', 4, '30days', ''),
(61, '60GB 7days', '14850', '14900', '14900', '14900', '107', 'SME', 4, '7days', ''),
(62, '100GB 30days', '19900', '19950', '19950', '19950', '108', 'SME', 4, '30days', ''),
(63, '100GB 30days', '19900', '19950', '19950', '19950', '109', 'SME', 4, '30days', ''),
(64, '200MB 14days', '91', '120', '120', '120', '110', 'SME', 2, '14days', ''),
(65, '500MB 30days', '202', '222', '222', '222', '111', 'Corporate', 2, '30days', ''),
(66, '750MB 1day', '206', '226', '226', '226', '112', 'SME', 2, '1day', ''),
(67, '1GB 3days', '285', '300', '300', '335', '113', 'SME', 2, '3days', ''),
(68, '1GB 7days', '325', '375', '375', '375', '114', 'Gifting', 2, '7days', ''),
(69, '1GB 14days', '335', '385', '385', '385', '115', 'Gifting', 2, '14days', ''),
(70, '1GB 1day', '346', '396', '396', '396', '116', 'SME', 2, '1day', ''),
(71, '1GB 30days', '398', '448', '448', '448', '117', 'Corporate', 2, '30days', ''),
(72, '1.5GB 1day', '302', '352', '352', '352', '118', 'SME', 2, '1day', ''),
(73, '2GB 1day', '490', '540', '540', '540', '119', 'SME', 2, '1day', ''),
(74, '2GB 30days', '796', '846', '846', '846', '120', 'Corporate', 2, '30days', ''),
(75, '2.5GB 2days', '493', '543', '543', '543', '121', 'SME', 2, '2days', ''),
(76, '3GB 3days', '825', '875', '875', '875', '122', 'SME', 2, '3days', ''),
(77, '3GB 7days', '975', '1025', '1025', '1025', '123', 'Gifting', 2, '7days', ''),
(78, '3GB 14days', '1005', '1055', '1055', '1055', '124', 'Gifting', 2, '14days', ''),
(79, '3GB 30days', '1194', '1244', '1244', '1244', '125', 'Corporate', 2, '30days', ''),
(80, '5GB 3days', '1375', '1425', '1425', '1425', '126', 'SME', 2, '3days', ''),
(81, '5GB 7days', '1625', '1675', '1675', '1675', '127', 'Gifting', 2, '7days', ''),
(82, '5GB 14days', '1675', '1725', '1725', '1725', '128', 'Gifting', 2, '14days', ''),
(83, '5GB 30days', '1990', '2040', '2040', '2040', '129', 'Corporate', 2, '30days', ''),
(84, '10GB 7days', '1925', '1975', '1975', '1975', '130', 'Gifting', 2, '7days', ''),
(85, '10GB 30days', '2855', '2905', '2905', '2905', '131', 'Corporate', 2, '30days', ''),
(86, '10GB 14days', '3350', '3400', '3400', '3400', '132', 'Gifting', 2, '14days', ''),
(87, '10GB 30days', '3980', '4030', '4030', '4030', '133', 'Corporate', 2, '30days', ''),
(88, '12GB 30days', '3795', '3845', '3845', '3845', '134', 'Corporate', 2, '30days', ''),
(89, '16GB 30days', '4745', '4795', '4795', '4795', '135', 'Corporate', 2, '30days', ''),
(90, '20GB 30days', '5680', '5730', '5730', '5730', '136', 'Corporate', 2, '30days', '');

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

--
-- Table structure for table `datatokens`
--

CREATE TABLE `datatokens` (
  `tId` int(11) NOT NULL,
  `sId` int(11) NOT NULL,
  `tRef` varchar(255) NOT NULL,
  `business` varchar(30) NOT NULL,
  `network` varchar(30) NOT NULL,
  `datasize` varchar(30) NOT NULL,
  `quantity` int(11) NOT NULL,
  `serial` text NOT NULL,
  `tokens` text NOT NULL,
  `date` datetime NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

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

--
-- Table structure for table `electricityid`
--

CREATE TABLE `electricityid` (
  `eId` int(11) NOT NULL,
  `electricityid` varchar(50) DEFAULT NULL,
  `provider` varchar(50) NOT NULL,
  `abbreviation` varchar(5) NOT NULL,
  `providerStatus` varchar(10) NOT NULL DEFAULT 'On'
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

--
-- Dumping data for table `electricityid`
--

INSERT INTO `electricityid` (`eId`, `electricityid`, `provider`, `abbreviation`, `providerStatus`) VALUES
(1, '1', 'Ikeja Electric', 'IE', 'On'),
(2, '2', 'Eko Electric', 'EKEDC', 'On'),
(3, '3', 'Kano Electric', 'KEDCO', 'On'),
(4, '4', 'Port Harcourt Electric', 'PHEDC', 'On'),
(5, '5', 'Jos Electric', 'JED', 'On'),
(6, '6', 'Ibadan Electric', 'IBEDC', 'On'),
(7, '7', 'Kaduna Electric', 'KEDC', 'On'),
(8, '8', 'Abuja Electric', 'AEDC', 'On'),
(9, '9', 'Enugu Electric', 'ENUGU', 'On'),
(10, '10', 'Benin Electric', 'BENIN', 'On'),
(11, '11', 'Yola Electric', 'YOLA', 'On');

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

--
-- Table structure for table `examid`
--

CREATE TABLE `examid` (
  `eId` int(11) NOT NULL,
  `examid` varchar(10) DEFAULT NULL,
  `provider` varchar(50) NOT NULL,
  `price` int(11) NOT NULL DEFAULT 0,
  `buying_price` int(11) NOT NULL DEFAULT 0,
  `providerStatus` varchar(10) NOT NULL DEFAULT 'On'
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

--
-- Dumping data for table `examid`
--

INSERT INTO `examid` (`eId`, `examid`, `provider`, `price`, `buying_price`, `providerStatus`) VALUES
(1, '1', 'WAEC', 2850, 2750, 'On'),
(2, '2', 'NECO', 900, 816, 'On'),
(3, '3', 'NABTEB', 880, 800, 'On');

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

--
-- Table structure for table `issues`
--

CREATE TABLE `issues` (
  `id` int(11) NOT NULL,
  `sId` varchar(50) DEFAULT NULL,
  `ref` varchar(255) DEFAULT NULL,
  `query` text DEFAULT NULL,
  `userEmail` varchar(255) DEFAULT NULL,
  `add_date` timestamp NOT NULL DEFAULT current_timestamp(),
  `user_read` tinyint(1) DEFAULT 0,
  `admin_read` tinyint(1) DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `maxkyc`
--

CREATE TABLE `maxkyc` (
  `id` varchar(255) NOT NULL,
  `sId` varchar(255) NOT NULL,
  `wemaBankRef` varchar(255) NOT NULL,
  `sterlingBankRef` varchar(255) NOT NULL,
  `rolexBankRef` varchar(255) NOT NULL,
  `bvn` varchar(255) NOT NULL,
  `nin` varchar(255) NOT NULL,
  `status` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

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

--
-- Table structure for table `monnify_accounts`
--

CREATE TABLE `monnify_accounts` (
  `id` int(200) NOT NULL,
  `accountReference` varchar(50) NOT NULL,
  `email` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

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

--
-- Table structure for table `networkid`
--

CREATE TABLE `networkid` (
  `nId` int(11) NOT NULL,
  `networkid` varchar(10) NOT NULL,
  `smeId` varchar(10) NOT NULL,
  `giftingId` varchar(10) NOT NULL,
  `corporateId` varchar(10) NOT NULL,
  `vtuId` varchar(10) NOT NULL,
  `sharesellId` varchar(10) NOT NULL,
  `network` varchar(20) NOT NULL,
  `networkStatus` varchar(10) NOT NULL DEFAULT 'Off',
  `vtuStatus` varchar(10) NOT NULL DEFAULT 'Off',
  `sharesellStatus` varchar(10) NOT NULL DEFAULT 'Off',
  `airtimepinStatus` varchar(10) NOT NULL DEFAULT 'Off',
  `smeStatus` varchar(10) NOT NULL DEFAULT 'Off',
  `giftingStatus` varchar(10) NOT NULL DEFAULT 'Off',
  `corporateStatus` varchar(10) NOT NULL DEFAULT 'Off',
  `datapinStatus` varchar(10) NOT NULL DEFAULT 'Off',
  `manualOrderStatus` varchar(10) NOT NULL DEFAULT 'Off',
  `momoStatus` varchar(10) NOT NULL DEFAULT 'Off',
  `sme2Id` varchar(20) NOT NULL,
  `sme2Status` varchar(20) NOT NULL,
  `rId` varchar(10) NOT NULL,
  `dId` varchar(10) NOT NULL,
  `couponStatus` varchar(10) NOT NULL,
  `couponId` varchar(10) NOT NULL,
  `dataId` varchar(10) NOT NULL,
  `dataStatus` varchar(10) NOT NULL,
  `corporate2Status` varchar(20) NOT NULL DEFAULT 'Off',
  `shareStatus` varchar(20) NOT NULL DEFAULT 'Off',
  `shareId` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

--
-- Dumping data for table `networkid`
--

INSERT INTO `networkid` (`nId`, `networkid`, `smeId`, `giftingId`, `corporateId`, `vtuId`, `sharesellId`, `network`, `networkStatus`, `vtuStatus`, `sharesellStatus`, `airtimepinStatus`, `smeStatus`, `giftingStatus`, `corporateStatus`, `datapinStatus`, `manualOrderStatus`, `momoStatus`, `sme2Id`, `sme2Status`, `rId`, `dId`, `couponStatus`, `couponId`, `dataId`, `dataStatus`, `corporate2Status`, `shareStatus`, `shareId`) VALUES
(1, '1', '1', '1', '', '1', '1', 'MTN', 'On', 'Off', 'Off', 'On', 'On', 'On', 'On', 'On', '', '1', '1', 'On', '1', '1', 'Off', '1', '1', 'Off', '', 'Off', '1'),
(2, '3', '2', '2', '2', '2', '2', 'GLO', 'On', 'On', 'Off', 'On', 'On', 'On', 'On', 'On', '', '3', '3', 'Off', '3', '3', 'Off', '3', '3', 'Off', '', 'Off', ''),
(3, '4', '3', '3', '3', '3', '3', '9MOBILE', 'On', 'On', 'Off', 'On', 'Off', 'Off', 'On', 'Off', 'Off', 'Off', '3', 'Off', '4', '5', 'Off', '3', '1', 'Off', '', 'Off', ''),
(4, '2', '4', '3', '4', '4', '4', 'AIRTEL', 'On', 'On', 'Off', 'On', 'On', 'On', 'On', 'On', '', '4', '4', 'Off', '2', '4', 'On', '4', '4', 'Off', '', 'Off', '');

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

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

CREATE TABLE `notifications` (
  `msgId` int(11) NOT NULL,
  `msgfor` tinyint(4) NOT NULL,
  `subject` varchar(200) NOT NULL,
  `message` text NOT NULL,
  `status` tinyint(4) NOT NULL DEFAULT 0,
  `dPosted` datetime NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

--
-- Dumping data for table `notifications`
--

INSERT INTO `notifications` (`msgId`, `msgfor`, `subject`, `message`, `status`, `dPosted`) VALUES
(11, 3, 'Welcome to HanandataApp ', 'Welcome to HanandataApp ', 0, '2026-06-15 07:23:42');

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

--
-- Table structure for table `replies`
--

CREATE TABLE `replies` (
  `Id` int(11) NOT NULL,
  `issue_id` int(11) DEFAULT NULL,
  `replyby` varchar(20) DEFAULT NULL,
  `reply` text DEFAULT NULL,
  `img` varchar(255) DEFAULT NULL,
  `reply_date` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `sitesettings`
--

CREATE TABLE `sitesettings` (
  `sId` int(11) NOT NULL,
  `sitename` varchar(20) DEFAULT NULL,
  `siteurl` varchar(100) DEFAULT NULL,
  `agentupgrade` varchar(20) DEFAULT NULL,
  `vendorupgrade` varchar(20) DEFAULT NULL,
  `apidocumentation` varchar(100) DEFAULT NULL,
  `phone` varchar(20) DEFAULT NULL,
  `email` varchar(50) DEFAULT NULL,
  `whatsapp` varchar(20) DEFAULT NULL,
  `whatsappgroup` varchar(100) DEFAULT NULL,
  `facebook` varchar(10) DEFAULT NULL,
  `twitter` varchar(200) DEFAULT NULL,
  `instagram` varchar(200) DEFAULT NULL,
  `telegram` varchar(100) DEFAULT NULL,
  `referalupgradebonus` float NOT NULL DEFAULT 100,
  `referalairtimebonus` float NOT NULL DEFAULT 1,
  `referaldatabonus` float NOT NULL DEFAULT 1,
  `referalwalletbonus` float NOT NULL DEFAULT 1,
  `referalcablebonus` float NOT NULL DEFAULT 1,
  `referalexambonus` float NOT NULL DEFAULT 1,
  `referalmeterbonus` float NOT NULL DEFAULT 1,
  `wallettowalletcharges` float NOT NULL DEFAULT 50,
  `sitecolor` varchar(10) NOT NULL DEFAULT '#0000e6',
  `logindesign` varchar(10) NOT NULL DEFAULT '5',
  `homedesign` varchar(10) NOT NULL DEFAULT '5',
  `notificationStatus` varchar(5) NOT NULL DEFAULT 'Off',
  `accountname` varchar(50) DEFAULT NULL,
  `accountno` varchar(15) DEFAULT NULL,
  `bankname` varchar(20) DEFAULT NULL,
  `electricitycharges` varchar(5) DEFAULT NULL,
  `airtimemin` varchar(10) NOT NULL DEFAULT '50',
  `airtimemax` varchar(10) NOT NULL DEFAULT '500',
  `kycOption` varchar(5) NOT NULL,
  `kycBvnCharges` varchar(5) NOT NULL,
  `kycNinCharges` varchar(5) NOT NULL,
  `kycShouldVerify` varchar(5) NOT NULL,
  `kycShouldEnable` varchar(5) NOT NULL,
  `smilediscount` varchar(3) DEFAULT NULL,
  `airtimedaily` varchar(255) DEFAULT '5000'
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

--
-- Dumping data for table `sitesettings`
--

INSERT INTO `sitesettings` (`sId`, `sitename`, `siteurl`, `agentupgrade`, `vendorupgrade`, `apidocumentation`, `phone`, `email`, `whatsapp`, `whatsappgroup`, `facebook`, `twitter`, `instagram`, `telegram`, `referalupgradebonus`, `referalairtimebonus`, `referaldatabonus`, `referalwalletbonus`, `referalcablebonus`, `referalexambonus`, `referalmeterbonus`, `wallettowalletcharges`, `sitecolor`, `logindesign`, `homedesign`, `notificationStatus`, `accountname`, `accountno`, `bankname`, `electricitycharges`, `airtimemin`, `airtimemax`, `kycOption`, `kycBvnCharges`, `kycNinCharges`, `kycShouldVerify`, `kycShouldEnable`, `smilediscount`, `airtimedaily`) VALUES
(1, 'HANAN DATASUB', 'hanandatasub.com.ng/', '50', '10000', 'hanandatasub.com.ng/', '08026878560', 'hanandatasub@gmail.com', '08026878560', 'https://chat.whatsapp.com/C8bIs0WAx2y1bu6yhDX9Q5?s=cl&p=a&mlu=1&amv=3', ' ', '', '', '', 0, 1, 1, 1, 1, 1, 1, 10, '#00ffff', '5', '5', 'On', 'Ahmad Abbass', '6115108127', 'Opay Digital service', '50', '50', '5000', 'both', '0', '0', 'no', 'no', '2', '5000');

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

--
-- Table structure for table `strowallet_accounts`
--

CREATE TABLE `strowallet_accounts` (
  `id` int(11) NOT NULL,
  `userid` varchar(200) DEFAULT NULL,
  `email` varchar(50) NOT NULL,
  `bankly` varchar(20) DEFAULT NULL,
  `safehaven` varchar(20) DEFAULT NULL,
  `paga` varchar(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

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

--
-- Table structure for table `subscribers`
--

CREATE TABLE `subscribers` (
  `sId` int(11) NOT NULL,
  `sApiKey` varchar(200) NOT NULL,
  `sFname` varchar(50) NOT NULL,
  `sLname` varchar(50) NOT NULL,
  `sEmail` varchar(50) DEFAULT NULL,
  `sPhone` varchar(20) NOT NULL,
  `sPass` varchar(150) NOT NULL,
  `sState` varchar(50) NOT NULL,
  `sPin` int(11) NOT NULL DEFAULT 1234,
  `sPinStatus` tinyint(4) DEFAULT 0,
  `sType` tinyint(4) NOT NULL DEFAULT 1,
  `sWallet` float NOT NULL DEFAULT 0,
  `sRefWallet` float NOT NULL DEFAULT 0,
  `sBankNo` varchar(20) DEFAULT NULL,
  `sRolexBank` varchar(20) DEFAULT NULL,
  `sSterlingBank` varchar(20) DEFAULT NULL,
  `sFidelityBank` varchar(20) DEFAULT NULL,
  `sBankName` varchar(30) DEFAULT NULL,
  `sRegStatus` tinyint(4) NOT NULL DEFAULT 3,
  `sVerCode` smallint(6) NOT NULL DEFAULT 0,
  `sRegDate` datetime NOT NULL DEFAULT current_timestamp(),
  `sLastActivity` datetime DEFAULT NULL,
  `sReferal` varchar(15) DEFAULT NULL,
  `rolexBankRef` varchar(255) DEFAULT NULL,
  `wemaBankRef` varchar(255) DEFAULT NULL,
  `sterlingBankRef` varchar(255) DEFAULT NULL,
  `fidelityBankRef` varchar(255) DEFAULT NULL,
  `sPayvesselBank` varchar(255) DEFAULT NULL,
  `kycstatus` varchar(255) DEFAULT NULL,
  `sKycDate` datetime DEFAULT NULL,
  `sVirtualAccountRef` varchar(255) DEFAULT NULL,
  `sKYC` int(11) DEFAULT NULL,
  `sAccountLimit` varchar(255) DEFAULT '40000',
  `sVpay` varchar(30) DEFAULT NULL,
  `sPagaBank` varchar(30) DEFAULT NULL,
  `sDynamicBank` varchar(30) DEFAULT NULL,
  `sDynamicBankExpiry` varchar(30) DEFAULT NULL,
  `sPalmpayBank` varchar(30) DEFAULT NULL,
  `pVerify` varchar(255) DEFAULT NULL,
  `sStrowalletPagaBank` varchar(255) DEFAULT NULL,
  `sStrowalletBanklyBank` varchar(255) DEFAULT NULL,
  `sStrowalletSafehavenBank` varchar(255) DEFAULT NULL,
  `sStrowalletAmuchaBank` varchar(255) DEFAULT NULL,
  `sBanklyBank` varchar(30) DEFAULT NULL,
  `sProvidusBank` varchar(30) DEFAULT NULL,
  `sSafehavenBank` varchar(11) DEFAULT NULL,
  `sAspfiyPalmpayBank` varchar(30) DEFAULT NULL,
  `sPaymentPointBank` varchar(50) DEFAULT NULL,
  `sAspfiySafehavenBank` varchar(50) DEFAULT NULL,
  `sCard` varchar(50) DEFAULT NULL,
  `sPinToken` varchar(200) NOT NULL DEFAULT '70c3b4b1fe',
  `sLPinStatus` varchar(11) NOT NULL DEFAULT '1',
  `sIPAddress` varchar(50) DEFAULT NULL,
  `sCashBack` varchar(40) DEFAULT NULL,
  `sBvn` varchar(40) DEFAULT NULL,
  `sNin` varchar(40) DEFAULT NULL,
  `sDob` varchar(40) DEFAULT NULL,
  `sKycStatus` varchar(15) DEFAULT NULL,
  `accountReference` varchar(50) DEFAULT NULL,
  `s9PSBBank` varchar(30) DEFAULT NULL,
  `sAsfiyBank` varchar(50) DEFAULT NULL,
  `sAspfiyBank` varchar(255) DEFAULT NULL,
  `sAmaaavlBank` varchar(50) NOT NULL,
  `sAmaaavlName` varchar(50) NOT NULL,
  `sAmaaavlNumber` varchar(50) NOT NULL,
  `topupmateCustomerId` varchar(50) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

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

--
-- Table structure for table `sysusers`
--

CREATE TABLE `sysusers` (
  `sysId` int(11) NOT NULL,
  `sysName` varchar(50) NOT NULL,
  `sysRole` tinyint(4) NOT NULL,
  `sysUsername` varchar(20) NOT NULL,
  `sysToken` varchar(30) NOT NULL,
  `sysStatus` tinyint(4) NOT NULL DEFAULT 0,
  `sysPinToken` varchar(30) NOT NULL DEFAULT '03d258c7ef',
  `sysPinStatus` tinyint(4) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

--
-- Dumping data for table `sysusers`
--

INSERT INTO `sysusers` (`sysId`, `sysName`, `sysRole`, `sysUsername`, `sysToken`, `sysStatus`, `sysPinToken`, `sysPinStatus`) VALUES
(4, 'hanan', 1, 'admin', 'admin1234', 0, '03d258c7ef', 0);

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

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

CREATE TABLE `transactions` (
  `tId` int(11) NOT NULL,
  `sId` int(11) NOT NULL,
  `transref` varchar(255) NOT NULL,
  `servicename` varchar(100) NOT NULL,
  `servicedesc` varchar(255) NOT NULL,
  `amount` varchar(100) NOT NULL,
  `status` tinyint(4) NOT NULL,
  `oldbal` varchar(100) NOT NULL,
  `newbal` varchar(100) NOT NULL,
  `profit` float NOT NULL DEFAULT 0,
  `date` datetime NOT NULL DEFAULT current_timestamp(),
  `api_response` text DEFAULT NULL,
  `api_response_log` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

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

--
-- Table structure for table `userlogin`
--

CREATE TABLE `userlogin` (
  `id` int(11) NOT NULL,
  `user` int(11) NOT NULL,
  `token` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

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

--
-- Table structure for table `uservisits`
--

CREATE TABLE `uservisits` (
  `id` int(11) NOT NULL,
  `user` int(11) NOT NULL,
  `state` varchar(10) NOT NULL,
  `visitTime` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `airtime`
--
ALTER TABLE `airtime`
  ADD PRIMARY KEY (`aId`);

--
-- Indexes for table `airtimepin`
--
ALTER TABLE `airtimepin`
  ADD PRIMARY KEY (`aId`);

--
-- Indexes for table `airtimepinprice`
--
ALTER TABLE `airtimepinprice`
  ADD PRIMARY KEY (`aId`);

--
-- Indexes for table `airtimetokens`
--
ALTER TABLE `airtimetokens`
  ADD PRIMARY KEY (`tId`);

--
-- Indexes for table `alphatopupprice`
--
ALTER TABLE `alphatopupprice`
  ADD PRIMARY KEY (`alphaId`);

--
-- Indexes for table `apiconfigs`
--
ALTER TABLE `apiconfigs`
  ADD PRIMARY KEY (`aId`);

--
-- Indexes for table `apilinks`
--
ALTER TABLE `apilinks`
  ADD PRIMARY KEY (`aId`);

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

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

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

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

--
-- Indexes for table `cableid`
--
ALTER TABLE `cableid`
  ADD PRIMARY KEY (`cId`);

--
-- Indexes for table `cableplans`
--
ALTER TABLE `cableplans`
  ADD PRIMARY KEY (`cpId`);

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

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

--
-- Indexes for table `contact`
--
ALTER TABLE `contact`
  ADD PRIMARY KEY (`msgId`);

--
-- Indexes for table `datapins`
--
ALTER TABLE `datapins`
  ADD PRIMARY KEY (`dpId`);

--
-- Indexes for table `dataplans`
--
ALTER TABLE `dataplans`
  ADD PRIMARY KEY (`pId`);

--
-- Indexes for table `datatokens`
--
ALTER TABLE `datatokens`
  ADD PRIMARY KEY (`tId`);

--
-- Indexes for table `electricityid`
--
ALTER TABLE `electricityid`
  ADD PRIMARY KEY (`eId`);

--
-- Indexes for table `examid`
--
ALTER TABLE `examid`
  ADD PRIMARY KEY (`eId`);

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

--
-- Indexes for table `monnify_accounts`
--
ALTER TABLE `monnify_accounts`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `accountReference` (`accountReference`),
  ADD UNIQUE KEY `email` (`email`);

--
-- Indexes for table `networkid`
--
ALTER TABLE `networkid`
  ADD PRIMARY KEY (`nId`);

--
-- Indexes for table `notifications`
--
ALTER TABLE `notifications`
  ADD PRIMARY KEY (`msgId`);

--
-- Indexes for table `replies`
--
ALTER TABLE `replies`
  ADD PRIMARY KEY (`Id`),
  ADD KEY `fk_issue_id` (`issue_id`);

--
-- Indexes for table `sitesettings`
--
ALTER TABLE `sitesettings`
  ADD PRIMARY KEY (`sId`);

--
-- Indexes for table `strowallet_accounts`
--
ALTER TABLE `strowallet_accounts`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `email` (`email`);

--
-- Indexes for table `subscribers`
--
ALTER TABLE `subscribers`
  ADD PRIMARY KEY (`sId`),
  ADD UNIQUE KEY `sApiKey` (`sApiKey`),
  ADD UNIQUE KEY `sPhone` (`sPhone`),
  ADD UNIQUE KEY `sEmail` (`sEmail`);

--
-- Indexes for table `sysusers`
--
ALTER TABLE `sysusers`
  ADD PRIMARY KEY (`sysId`);

--
-- Indexes for table `transactions`
--
ALTER TABLE `transactions`
  ADD PRIMARY KEY (`tId`),
  ADD UNIQUE KEY `transref` (`transref`);

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

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

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `airtime`
--
ALTER TABLE `airtime`
  MODIFY `aId` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;

--
-- AUTO_INCREMENT for table `airtimepin`
--
ALTER TABLE `airtimepin`
  MODIFY `aId` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=157;

--
-- AUTO_INCREMENT for table `airtimepinprice`
--
ALTER TABLE `airtimepinprice`
  MODIFY `aId` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT for table `airtimetokens`
--
ALTER TABLE `airtimetokens`
  MODIFY `tId` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `alphatopupprice`
--
ALTER TABLE `alphatopupprice`
  MODIFY `alphaId` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `apiconfigs`
--
ALTER TABLE `apiconfigs`
  MODIFY `aId` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=208;

--
-- AUTO_INCREMENT for table `apilinks`
--
ALTER TABLE `apilinks`
  MODIFY `aId` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=117;

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

--
-- AUTO_INCREMENT for table `BlackIP`
--
ALTER TABLE `BlackIP`
  MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;

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

--
-- AUTO_INCREMENT for table `bulksms`
--
ALTER TABLE `bulksms`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

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

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

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

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

--
-- AUTO_INCREMENT for table `contact`
--
ALTER TABLE `contact`
  MODIFY `msgId` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `datapins`
--
ALTER TABLE `datapins`
  MODIFY `dpId` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;

--
-- AUTO_INCREMENT for table `dataplans`
--
ALTER TABLE `dataplans`
  MODIFY `pId` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=161;

--
-- AUTO_INCREMENT for table `datatokens`
--
ALTER TABLE `datatokens`
  MODIFY `tId` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `electricityid`
--
ALTER TABLE `electricityid`
  MODIFY `eId` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;

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

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

--
-- AUTO_INCREMENT for table `monnify_accounts`
--
ALTER TABLE `monnify_accounts`
  MODIFY `id` int(200) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `networkid`
--
ALTER TABLE `networkid`
  MODIFY `nId` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT for table `notifications`
--
ALTER TABLE `notifications`
  MODIFY `msgId` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;

--
-- AUTO_INCREMENT for table `replies`
--
ALTER TABLE `replies`
  MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=16;

--
-- AUTO_INCREMENT for table `sitesettings`
--
ALTER TABLE `sitesettings`
  MODIFY `sId` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `strowallet_accounts`
--
ALTER TABLE `strowallet_accounts`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `subscribers`
--
ALTER TABLE `subscribers`
  MODIFY `sId` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `sysusers`
--
ALTER TABLE `sysusers`
  MODIFY `sysId` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT for table `transactions`
--
ALTER TABLE `transactions`
  MODIFY `tId` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `userlogin`
--
ALTER TABLE `userlogin`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `uservisits`
--
ALTER TABLE `uservisits`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
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 */;


-- CrediAjo BNPL + Digital Thrift/ROSCA Integration Migration
-- Import this AFTER your existing jjbytes database SQL.
-- This migration uses the existing subscribers table for users and sysusers table for admins.

CREATE TABLE IF NOT EXISTS `fin_settings` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `setting_key` varchar(100) NOT NULL,
  `setting_value` text DEFAULT NULL,
  `setting_group` varchar(80) DEFAULT 'general',
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `setting_key` (`setting_key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `fin_merchants` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `subscriber_id` int(11) DEFAULT NULL,
  `business_name` varchar(160) NOT NULL,
  `business_email` varchar(120) DEFAULT NULL,
  `business_phone` varchar(30) DEFAULT NULL,
  `business_type` varchar(80) DEFAULT NULL,
  `registration_number` varchar(80) DEFAULT NULL,
  `address` varchar(255) DEFAULT NULL,
  `city` varchar(100) DEFAULT NULL,
  `state` varchar(100) DEFAULT NULL,
  `logo` varchar(255) DEFAULT NULL,
  `commission_rate` decimal(7,4) DEFAULT 0.0000,
  `wallet_balance` decimal(18,2) DEFAULT 0.00,
  `risk_rating` enum('low','medium','high') DEFAULT 'medium',
  `status` enum('pending','approved','suspended','rejected') DEFAULT 'pending',
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `subscriber_id` (`subscriber_id`),
  KEY `status` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `fin_product_categories` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(120) NOT NULL,
  `slug` varchar(140) NOT NULL,
  `icon` varchar(80) DEFAULT 'fa-box',
  `description` text DEFAULT NULL,
  `status` enum('active','inactive') DEFAULT 'active',
  PRIMARY KEY (`id`),
  UNIQUE KEY `slug` (`slug`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `fin_products` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `merchant_id` int(11) DEFAULT NULL,
  `category_id` int(11) DEFAULT NULL,
  `name` varchar(180) NOT NULL,
  `slug` varchar(220) NOT NULL,
  `sku` varchar(80) DEFAULT NULL,
  `short_description` varchar(255) DEFAULT NULL,
  `description` text DEFAULT NULL,
  `specifications` text DEFAULT NULL,
  `price` decimal(18,2) NOT NULL DEFAULT 0.00,
  `sale_price` decimal(18,2) DEFAULT NULL,
  `stock_quantity` int(11) DEFAULT 0,
  `min_down_payment_percent` decimal(6,2) DEFAULT 20.00,
  `max_tenor_months` int(11) DEFAULT 12,
  `interest_rate_percent` decimal(6,2) DEFAULT 3.50,
  `warranty_info` varchar(255) DEFAULT NULL,
  `delivery_options` varchar(255) DEFAULT NULL,
  `image` varchar(255) DEFAULT NULL,
  `video_url` varchar(255) DEFAULT NULL,
  `rating` decimal(3,2) DEFAULT 0.00,
  `review_count` int(11) DEFAULT 0,
  `status` enum('draft','active','out_of_stock','suspended') DEFAULT 'active',
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `slug` (`slug`),
  KEY `merchant_id` (`merchant_id`),
  KEY `category_id` (`category_id`),
  KEY `status` (`status`),
  KEY `price` (`price`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `fin_product_media` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `product_id` int(11) NOT NULL,
  `media_type` enum('image','video') DEFAULT 'image',
  `url` varchar(255) NOT NULL,
  `sort_order` int(11) DEFAULT 0,
  PRIMARY KEY (`id`),
  KEY `product_id` (`product_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `fin_product_variants` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `product_id` int(11) NOT NULL,
  `variant_name` varchar(100) NOT NULL,
  `variant_value` varchar(120) NOT NULL,
  `price_adjustment` decimal(18,2) DEFAULT 0.00,
  `stock_quantity` int(11) DEFAULT 0,
  PRIMARY KEY (`id`),
  KEY `product_id` (`product_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `fin_credit_profiles` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `subscriber_id` int(11) NOT NULL,
  `employment_status` varchar(80) DEFAULT NULL,
  `employer_name` varchar(150) DEFAULT NULL,
  `monthly_income` decimal(18,2) DEFAULT 0.00,
  `income_source` varchar(120) DEFAULT NULL,
  `bank_name` varchar(120) DEFAULT NULL,
  `bvn_status` enum('not_submitted','pending','verified','failed') DEFAULT 'not_submitted',
  `nin_status` enum('not_submitted','pending','verified','failed') DEFAULT 'not_submitted',
  `address_status` enum('not_submitted','pending','verified','failed') DEFAULT 'not_submitted',
  `device_reputation_score` int(11) DEFAULT 50,
  `behaviour_score` int(11) DEFAULT 50,
  `risk_level` enum('low','medium','high') DEFAULT 'medium',
  `credit_limit` decimal(18,2) DEFAULT 0.00,
  `available_credit` decimal(18,2) DEFAULT 0.00,
  `last_scored_at` datetime 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 `subscriber_id` (`subscriber_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `fin_credit_scores` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `subscriber_id` int(11) NOT NULL,
  `score` int(11) NOT NULL DEFAULT 300,
  `score_band` varchar(50) DEFAULT 'starter',
  `risk_score` decimal(8,4) DEFAULT 0.0000,
  `factors_json` longtext DEFAULT NULL,
  `model_version` varchar(50) DEFAULT 'rule-engine-v1',
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `subscriber_id` (`subscriber_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `fin_bnpl_applications` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `application_ref` varchar(80) NOT NULL,
  `subscriber_id` int(11) NOT NULL,
  `product_id` int(11) DEFAULT NULL,
  `merchant_id` int(11) DEFAULT NULL,
  `product_name` varchar(180) DEFAULT NULL,
  `principal_amount` decimal(18,2) NOT NULL,
  `down_payment` decimal(18,2) DEFAULT 0.00,
  `financed_amount` decimal(18,2) NOT NULL,
  `interest_rate_percent` decimal(8,2) DEFAULT 0.00,
  `tenor_months` int(11) DEFAULT 1,
  `frequency` enum('weekly','biweekly','monthly','quarterly','semiannual','annual','custom') DEFAULT 'monthly',
  `installment_amount` decimal(18,2) DEFAULT 0.00,
  `total_payable` decimal(18,2) DEFAULT 0.00,
  `purpose` varchar(255) DEFAULT NULL,
  `credit_score` int(11) DEFAULT NULL,
  `ai_risk_band` enum('low','medium','high') DEFAULT 'medium',
  `status` enum('draft','pending','approved','rejected','active','completed','defaulted','cancelled') DEFAULT 'pending',
  `decision_reason` text DEFAULT NULL,
  `approved_by` int(11) DEFAULT NULL,
  `approved_at` datetime 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 `application_ref` (`application_ref`),
  KEY `subscriber_id` (`subscriber_id`),
  KEY `merchant_id` (`merchant_id`),
  KEY `status` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `fin_bnpl_installments` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `application_id` int(11) NOT NULL,
  `installment_no` int(11) NOT NULL,
  `due_date` date NOT NULL,
  `amount_due` decimal(18,2) NOT NULL,
  `amount_paid` decimal(18,2) DEFAULT 0.00,
  `penalty_amount` decimal(18,2) DEFAULT 0.00,
  `status` enum('pending','part_paid','paid','overdue','waived') DEFAULT 'pending',
  `paid_at` datetime DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `application_id` (`application_id`),
  KEY `due_date` (`due_date`),
  KEY `status` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `fin_wallet_ledger` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `ledger_ref` varchar(80) NOT NULL,
  `subscriber_id` int(11) DEFAULT NULL,
  `merchant_id` int(11) DEFAULT NULL,
  `entry_type` enum('credit','debit') NOT NULL,
  `source` varchar(80) NOT NULL,
  `amount` decimal(18,2) NOT NULL,
  `old_balance` decimal(18,2) DEFAULT 0.00,
  `new_balance` decimal(18,2) DEFAULT 0.00,
  `status` enum('pending','successful','failed','reversed') DEFAULT 'successful',
  `description` varchar(255) DEFAULT NULL,
  `gateway` varchar(80) DEFAULT NULL,
  `gateway_ref` varchar(120) DEFAULT NULL,
  `metadata_json` longtext DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `ledger_ref` (`ledger_ref`),
  KEY `subscriber_id` (`subscriber_id`),
  KEY `merchant_id` (`merchant_id`),
  KEY `source` (`source`),
  KEY `status` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `fin_thrift_groups` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `group_ref` varchar(80) NOT NULL,
  `creator_id` int(11) NOT NULL,
  `group_name` varchar(160) NOT NULL,
  `description` text DEFAULT NULL,
  `group_type` enum('private','public','family','corporate','cooperative','community','religious','friends','women','students','business') DEFAULT 'private',
  `contribution_amount` decimal(18,2) NOT NULL,
  `member_limit` int(11) DEFAULT 10,
  `frequency` enum('daily','weekly','biweekly','monthly','quarterly','yearly','custom') DEFAULT 'monthly',
  `start_date` date DEFAULT NULL,
  `end_date` date DEFAULT NULL,
  `rotation_method` enum('random_draw','manual_order','first_registered','auction','voting','priority','emergency','admin_selection','lottery','custom_order') DEFAULT 'first_registered',
  `late_fee` decimal(18,2) DEFAULT 0.00,
  `penalty_percent` decimal(8,2) DEFAULT 0.00,
  `grace_period_days` int(11) DEFAULT 3,
  `auto_removal` tinyint(1) DEFAULT 0,
  `voting_enabled` tinyint(1) DEFAULT 0,
  `invite_code` varchar(80) DEFAULT NULL,
  `private_password` varchar(255) DEFAULT NULL,
  `group_rules` text DEFAULT NULL,
  `admin_approval_required` tinyint(1) DEFAULT 1,
  `waiting_list_enabled` tinyint(1) DEFAULT 1,
  `reserve_members` int(11) DEFAULT 0,
  `status` enum('draft','open','active','paused','completed','cancelled') DEFAULT 'open',
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `group_ref` (`group_ref`),
  UNIQUE KEY `invite_code` (`invite_code`),
  KEY `creator_id` (`creator_id`),
  KEY `status` (`status`),
  KEY `group_type` (`group_type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `fin_thrift_group_members` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `group_id` int(11) NOT NULL,
  `subscriber_id` int(11) NOT NULL,
  `rotation_position` int(11) DEFAULT NULL,
  `member_role` enum('creator','admin','member','reserve') DEFAULT 'member',
  `status` enum('pending','active','suspended','removed','completed') DEFAULT 'pending',
  `joined_at` timestamp NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `group_user` (`group_id`,`subscriber_id`),
  KEY `subscriber_id` (`subscriber_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `fin_thrift_contributions` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `group_id` int(11) NOT NULL,
  `subscriber_id` int(11) NOT NULL,
  `cycle_no` int(11) DEFAULT 1,
  `due_date` date DEFAULT NULL,
  `amount_due` decimal(18,2) NOT NULL,
  `amount_paid` decimal(18,2) DEFAULT 0.00,
  `penalty_amount` decimal(18,2) DEFAULT 0.00,
  `payment_ref` varchar(120) DEFAULT NULL,
  `status` enum('pending','paid','late','missed','waived') DEFAULT 'pending',
  `paid_at` datetime DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `group_id` (`group_id`),
  KEY `subscriber_id` (`subscriber_id`),
  KEY `status` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `fin_thrift_payouts` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `group_id` int(11) NOT NULL,
  `subscriber_id` int(11) NOT NULL,
  `cycle_no` int(11) DEFAULT 1,
  `amount` decimal(18,2) NOT NULL,
  `method` varchar(80) DEFAULT 'wallet',
  `status` enum('scheduled','processing','paid','failed','cancelled') DEFAULT 'scheduled',
  `scheduled_date` date DEFAULT NULL,
  `paid_at` datetime DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `group_id` (`group_id`),
  KEY `subscriber_id` (`subscriber_id`),
  KEY `status` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `fin_referrals` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `referrer_id` int(11) NOT NULL,
  `referred_id` int(11) DEFAULT NULL,
  `campaign` varchar(100) DEFAULT NULL,
  `bonus_amount` decimal(18,2) DEFAULT 0.00,
  `status` enum('pending','earned','paid','rejected') DEFAULT 'pending',
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `referrer_id` (`referrer_id`),
  KEY `referred_id` (`referred_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `fin_rewards` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `subscriber_id` int(11) NOT NULL,
  `reward_type` varchar(80) NOT NULL,
  `points` int(11) DEFAULT 0,
  `amount` decimal(18,2) DEFAULT 0.00,
  `description` varchar(255) DEFAULT NULL,
  `status` enum('pending','available','redeemed','expired') DEFAULT 'available',
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `subscriber_id` (`subscriber_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `fin_kyc_documents` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `subscriber_id` int(11) NOT NULL,
  `document_type` enum('bvn','nin','passport','national_id','driver_license','utility_bill','selfie','cac','other') DEFAULT 'other',
  `document_number` varchar(120) DEFAULT NULL,
  `file_path` varchar(255) DEFAULT NULL,
  `verification_status` enum('pending','verified','failed','expired') DEFAULT 'pending',
  `risk_score` int(11) DEFAULT 50,
  `reviewed_by` int(11) DEFAULT NULL,
  `reviewed_at` datetime DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `subscriber_id` (`subscriber_id`),
  KEY `document_type` (`document_type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `fin_deliveries` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `bnpl_application_id` int(11) DEFAULT NULL,
  `merchant_id` int(11) DEFAULT NULL,
  `subscriber_id` int(11) DEFAULT NULL,
  `courier_name` varchar(120) DEFAULT NULL,
  `tracking_code` varchar(120) DEFAULT NULL,
  `delivery_address` varchar(255) DEFAULT NULL,
  `scheduled_date` date DEFAULT NULL,
  `proof_of_delivery` varchar(255) DEFAULT NULL,
  `status` enum('pending','assigned','in_transit','delivered','failed','returned') DEFAULT 'pending',
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `bnpl_application_id` (`bnpl_application_id`),
  KEY `status` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `fin_support_tickets` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `ticket_ref` varchar(80) NOT NULL,
  `subscriber_id` int(11) DEFAULT NULL,
  `merchant_id` int(11) DEFAULT NULL,
  `category` varchar(80) DEFAULT NULL,
  `subject` varchar(180) NOT NULL,
  `message` text DEFAULT NULL,
  `priority` enum('low','medium','high','urgent') DEFAULT 'medium',
  `status` enum('open','pending','resolved','closed') DEFAULT 'open',
  `assigned_to` int(11) 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 `ticket_ref` (`ticket_ref`),
  KEY `subscriber_id` (`subscriber_id`),
  KEY `status` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `fin_notifications` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `subscriber_id` int(11) DEFAULT NULL,
  `channel` enum('email','sms','push','in_app','whatsapp','telegram','broadcast','webhook') DEFAULT 'in_app',
  `title` varchar(160) DEFAULT NULL,
  `message` text DEFAULT NULL,
  `status` enum('pending','sent','failed','read') DEFAULT 'pending',
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `subscriber_id` (`subscriber_id`),
  KEY `channel` (`channel`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `fin_ai_fraud_events` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `subscriber_id` int(11) DEFAULT NULL,
  `merchant_id` int(11) DEFAULT NULL,
  `event_type` varchar(100) NOT NULL,
  `risk_score` int(11) DEFAULT 50,
  `risk_band` enum('low','medium','high','critical') DEFAULT 'medium',
  `description` text DEFAULT NULL,
  `metadata_json` longtext DEFAULT NULL,
  `status` enum('open','reviewing','cleared','blocked') DEFAULT 'open',
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `risk_band` (`risk_band`),
  KEY `status` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `fin_admin_audit_logs` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `admin_id` int(11) DEFAULT NULL,
  `subscriber_id` int(11) DEFAULT NULL,
  `action` varchar(150) NOT NULL,
  `entity_type` varchar(80) DEFAULT NULL,
  `entity_id` int(11) DEFAULT NULL,
  `ip_address` varchar(80) DEFAULT NULL,
  `user_agent` varchar(255) DEFAULT NULL,
  `metadata_json` longtext DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `admin_id` (`admin_id`),
  KEY `entity_type` (`entity_type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `fin_api_keys` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `owner_type` enum('platform','merchant','subscriber') DEFAULT 'merchant',
  `owner_id` int(11) DEFAULT NULL,
  `api_key` varchar(128) NOT NULL,
  `secret_hash` varchar(255) DEFAULT NULL,
  `environment` enum('sandbox','production') DEFAULT 'sandbox',
  `status` enum('active','revoked') DEFAULT 'active',
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `api_key` (`api_key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `fin_api_logs` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `api_key_id` int(11) DEFAULT NULL,
  `endpoint` varchar(180) DEFAULT NULL,
  `method` varchar(20) DEFAULT NULL,
  `status_code` int(11) DEFAULT NULL,
  `ip_address` varchar(80) DEFAULT NULL,
  `request_body` longtext DEFAULT NULL,
  `response_body` longtext DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `api_key_id` (`api_key_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `fin_webhook_logs` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `provider` varchar(80) DEFAULT NULL,
  `event_type` varchar(120) DEFAULT NULL,
  `payload` longtext DEFAULT NULL,
  `signature_valid` tinyint(1) DEFAULT 0,
  `status` enum('received','processed','failed') DEFAULT 'received',
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `provider` (`provider`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `fin_promotions` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `title` varchar(160) NOT NULL,
  `promo_type` varchar(80) DEFAULT 'cashback',
  `value` decimal(18,2) DEFAULT 0.00,
  `starts_at` datetime DEFAULT NULL,
  `ends_at` datetime DEFAULT NULL,
  `status` enum('draft','active','expired','paused') DEFAULT 'draft',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `fin_coupons` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `code` varchar(80) NOT NULL,
  `discount_type` enum('fixed','percent') DEFAULT 'fixed',
  `discount_value` decimal(18,2) DEFAULT 0.00,
  `usage_limit` int(11) DEFAULT NULL,
  `used_count` int(11) DEFAULT 0,
  `status` enum('active','inactive','expired') DEFAULT 'active',
  PRIMARY KEY (`id`),
  UNIQUE KEY `code` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `fin_settlements` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `merchant_id` int(11) DEFAULT NULL,
  `settlement_ref` varchar(80) NOT NULL,
  `gross_amount` decimal(18,2) DEFAULT 0.00,
  `commission_amount` decimal(18,2) DEFAULT 0.00,
  `net_amount` decimal(18,2) DEFAULT 0.00,
  `status` enum('pending','processing','paid','failed') DEFAULT 'pending',
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `settlement_ref` (`settlement_ref`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `fin_reconciliations` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `provider` varchar(80) DEFAULT NULL,
  `expected_amount` decimal(18,2) DEFAULT 0.00,
  `actual_amount` decimal(18,2) DEFAULT 0.00,
  `variance` decimal(18,2) DEFAULT 0.00,
  `status` enum('matched','unmatched','investigating','resolved') DEFAULT 'matched',
  `notes` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- Seed fintech settings
INSERT IGNORE INTO `fin_settings` (`setting_key`,`setting_value`,`setting_group`) VALUES
('bnpl_default_interest_rate','3.5','bnpl'),
('bnpl_min_down_payment_percent','20','bnpl'),
('bnpl_max_tenor_months','12','bnpl'),
('thrift_platform_commission_percent','1.0','thrift'),
('fraud_high_risk_threshold','75','risk'),
('payment_gateway_mode','manual_placeholder','payment'),
('paymentpoint_integration_status','already-integrated-existing-system','payment'),
('platform_brand_name','CrediAjo','brand');

-- Seed categories matching the master prompt.
INSERT IGNORE INTO `fin_product_categories` (`name`,`slug`,`icon`,`description`) VALUES
('Smartphones','smartphones','fa-mobile-alt','Phones available for installment purchase.'),
('Laptops','laptops','fa-laptop','Computers and work devices.'),
('Tablets','tablets','fa-tablet-alt','Tablets for school and business.'),
('Smartwatches','smartwatches','fa-clock','Wearables and accessories.'),
('TVs','tvs','fa-tv','Smart TVs and home entertainment.'),
('Home Appliances','home-appliances','fa-blender','Appliances for homes.'),
('Furniture','furniture','fa-couch','Premium furniture and interiors.'),
('Office Equipment','office-equipment','fa-briefcase','Printers, desks, office tools.'),
('Solar Equipment','solar-equipment','fa-solar-panel','Solar panels, inverters and batteries.'),
('Generators','generators','fa-bolt','Power generators.'),
('Motorcycles','motorcycles','fa-motorcycle','Transport and delivery motorcycles.'),
('Vehicles','vehicles','fa-car','Vehicle financing category.'),
('Fashion','fashion','fa-tshirt','Fashion products.'),
('Building Materials','building-materials','fa-hard-hat','Construction and building supplies.'),
('Medical Equipment','medical-equipment','fa-stethoscope','Medical and clinical equipment.'),
('Educational Products','educational-products','fa-book','School and education materials.'),
('Farm Equipment','farm-equipment','fa-tractor','Agricultural tools and machines.'),
('Industrial Equipment','industrial-equipment','fa-industry','Industrial equipment.'),
('Electronics','electronics','fa-plug','General electronics.'),
('Beauty Products','beauty-products','fa-spa','Beauty and personal care.'),
('Sports Equipment','sports-equipment','fa-football-ball','Sports products.'),
('Toys','toys','fa-gamepad','Toys and games.'),
('Books','books','fa-book-open','Books and learning materials.'),
('Digital Products','digital-products','fa-cloud-download-alt','Eligible digital goods.');

-- Seed a demo merchant and products. Replace later with live merchants.
INSERT IGNORE INTO `fin_merchants` (`id`,`business_name`,`business_email`,`business_phone`,`business_type`,`status`,`risk_rating`,`commission_rate`) VALUES
(1,'CrediAjo Demo Merchant','merchant@example.com','08000000000','Marketplace Demo','approved','low',2.5000);

INSERT IGNORE INTO `fin_products` (`id`,`merchant_id`,`category_id`,`name`,`slug`,`sku`,`short_description`,`description`,`specifications`,`price`,`stock_quantity`,`min_down_payment_percent`,`max_tenor_months`,`interest_rate_percent`,`warranty_info`,`delivery_options`,`image`,`rating`,`review_count`,`status`) VALUES
(1,1,1,'Premium Android Smartphone','premium-android-smartphone','BNPL-PHONE-001','High-performance smartphone with flexible repayment.','A premium smartphone eligible for BNPL installment purchase.','8GB RAM, 256GB Storage, 5000mAh Battery',350000,25,20,12,3.5,'12 months warranty','Doorstep delivery / pickup','assets/fintech/banners/banner-phone.svg',4.8,128,'active'),
(2,1,2,'Business Laptop Pro','business-laptop-pro','BNPL-LAP-001','Work laptop for business owners and students.','Reliable business laptop available with flexible installment repayment.','Core i5, 16GB RAM, 512GB SSD',650000,12,25,12,3.5,'12 months warranty','Insured courier delivery','assets/fintech/banners/banner-laptop.svg',4.7,64,'active'),
(3,1,9,'Solar Inverter Kit','solar-inverter-kit','BNPL-SOLAR-001','Solar and inverter package for homes.','Solar power package for homes and shops with repayment options.','1.5KVA inverter, battery, panels',950000,8,30,18,3.2,'Installation warranty','Installer delivery','assets/fintech/banners/banner-solar.svg',4.9,42,'active'),
(4,1,7,'Modern Home Sofa Set','modern-home-sofa-set','BNPL-FURN-001','Luxury furniture with installment plan.','Comfortable sofa set available through merchant financing.','7-seater, premium fabric, custom colours',480000,5,20,10,3.5,'6 months warranty','Merchant delivery','assets/fintech/banners/banner-furniture.svg',4.6,37,'active');
