CREATE TABLE `Product` (
  `id` int NOT NULL AUTO_INCREMENT,
  `name` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci NOT NULL,
  `description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci,
  `sla_id` int NOT NULL,
  `external` tinyint(1) NOT NULL DEFAULT '0',
  `producttech_id` int DEFAULT NULL,
  `productgroup_id` int DEFAULT NULL,
  `price_nne` decimal(14,4) DEFAULT NULL,
  `price_nbe` decimal(14,4) DEFAULT NULL,
  `price` decimal(14,4) NOT NULL,
  `price_setup` decimal(14,4) NOT NULL DEFAULT '0',
  `billing_delay` int NOT NULL DEFAULT '0' COMMENT 'in months',
  `billing_period` int NOT NULL COMMENT 'in months',
  `ivt_id` int DEFAULT NULL,
  `note` text COLLATE utf8mb4_unicode_520_ci,
  `create_by` int NOT NULL,
  `edit_by` int NOT NULL,
  `create` int NOT NULL,
  `edit` int NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

CREATE TABLE `ProductNetwork` (
  `id` int NOT NULL AUTO_INCREMENT,
  `product_id` int NOT NULL,
  `network_id` int NOT NULL,
  `create_by` int NOT NULL,
  `edit_by` int NOT NULL,
  `create` int NOT NULL,
  `edit` int NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

CREATE TABLE `ProductAttribute` (
  `id` int NOT NULL AUTO_INCREMENT,
  `product_id` int NOT NULL,
  `producttechattribute_id` int NOT NULL,
  `value` varchar(1024) COLLATE utf8mb4_unicode_520_ci NOT NULL,
  `create_by` int NOT NULL,
  `edit_by` int NOT NULL,
  `create` int NOT NULL,
  `edit` int NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

CREATE TABLE `Productgroup` (
  `id` int NOT NULL AUTO_INCREMENT,
  `name` varchar(1024) COLLATE utf8mb4_unicode_520_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_520_ci NOT NULL,
  `note` text COLLATE utf8mb4_unicode_520_ci NOT NULL,
  `create_by` int NOT NULL,
  `edit_by` int NOT NULL,
  `create` int NOT NULL,
  `edit` int NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

CREATE TABLE `Producttech` (
  `id` int NOT NULL AUTO_INCREMENT,
  `name` varchar(1024) COLLATE utf8mb4_unicode_520_ci NOT NULL,
  `rtrcode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci NOT NULL,
  `customer_type` enum('residential','business') COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT 'residential',
  `description` text COLLATE utf8mb4_unicode_520_ci NOT NULL,
  `note` text COLLATE utf8mb4_unicode_520_ci NOT NULL,
  `create_by` int NOT NULL,
  `edit_by` int NOT NULL,
  `create` int NOT NULL,
  `edit` int NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

CREATE TABLE `ProducttechAttribute` (
  `id` int NOT NULL AUTO_INCREMENT,
  `producttech_id` int NOT NULL,
  `name` varchar(1024) COLLATE utf8mb4_unicode_520_ci NOT NULL,
  `displayname` varchar(1024) COLLATE utf8mb4_unicode_520_ci NOT NULL,
  `value` varchar(1024) COLLATE utf8mb4_unicode_520_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_520_ci NOT NULL,
  `note` text COLLATE utf8mb4_unicode_520_ci NOT NULL,
  `create_by` int NOT NULL,
  `edit_by` int NOT NULL,
  `create` int NOT NULL,
  `edit` int NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

CREATE TABLE `Sla` (
  `id` int NOT NULL AUTO_INCREMENT,
  `name` varchar(1024) COLLATE utf8mb4_unicode_520_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_520_ci NOT NULL,
  `note` text COLLATE utf8mb4_unicode_520_ci NOT NULL,
  `create_by` int NOT NULL,
  `edit_by` int NOT NULL,
  `create` int NOT NULL,
  `edit` int NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

INSERT INTO `Sla` VALUES (1,'12h/6T - Working Hours','','',1,1,1625495944,1625495944),(2,'24h/7T - 2h/6h Emergency','','',1,1,1625495944,1625495944),(3,'8h/5T - Next Business Day','','',1,1,1625495985,1625495985),(4,'8h/5T - Residential','','',1,1,1625495985,1625495985);
