CREATE TABLE `tblwebsite_preview_templates` (
    `id` BIGINT(20) PRIMARY KEY AUTO_INCREMENT NOT NULL,
    `name` varchar(191) NOT NULL,
	`image` varchar(191) NOT NULL,
    `preview_details` longtext DEFAULT NULL, 
    `is_coming_soon` tinyint(4) DEFAULT 0,
	`is_default` tinyint(4) DEFAULT 0,
    `is_active` tinyint(4) DEFAULT 1,
    `added_on` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

INSERT INTO `tblwebsite_preview_templates` (`name`, `image`,`preview_details`,`is_coming_soon`,`is_default`, `is_active`, `added_on`) VALUES
('Templates 1','template1.png','{"master_folder":"template1","empty_preview_template":"template1_prev.jpg","valid_preview_template":"template1_prev_success.jpg","x_position":"250","y_position":"100","width":"","height":""}','0','1','1',UTC_TIMESTAMP()),
('Templates 2','template2.png','{"master_folder":"template2","empty_preview_template":"template2_prev.jpg","valid_preview_template":"template2_prev_success.jpg","x_position":"250","y_position":"100","width":"","height":""}','1','0','1',UTC_TIMESTAMP()),
('Templates 3','template3.png','{"master_folder":"template3","empty_preview_template":"template3_prev.jpg","valid_preview_template":"template3_prev_success.jpg","x_position":"250","y_position":"100","width":"","height":""}','1','0','1',UTC_TIMESTAMP()),
('Templates 4','template4.png',NULL,'1','0','1',UTC_TIMESTAMP());

CREATE TABLE `tbltenant_free_website_config` (
    `id` BIGINT(20) PRIMARY KEY AUTO_INCREMENT NOT NULL,
    `tenant_id` BIGINT(20) UNSIGNED NOT NULL,
    `preview_template_id` INT(10) DEFAULT NULL,
    `primary_color` varchar(10) DEFAULT NULL,
    `secondary_color` varchar(10) DEFAULT NULL,	
    `offer_free_estimate` tinyint(4) DEFAULT 1,    
    `reasons_to_hire_business` longtext DEFAULT NULL,
    `analytics_details` longtext DEFAULT NULL,  
    `chatgpt_count` longtext DEFAULT NULL,      
    `custom_domain` varchar(255) DEFAULT NULL,
	`custom_protocol` varchar(15) DEFAULT NULL,
    `selected_photos` varchar(100) DEFAULT NULL, 
    `steps_completed` varchar(100) DEFAULT NULL,    
    `added_by` bigint(20) unsigned NOT NULL,
    `added_on` datetime DEFAULT NULL,
    `updated_on` datetime DEFAULT NULL,
    KEY `tenant_id` (`tenant_id`),
    KEY `preview_template_id` (`preview_template_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `tbltenant_free_website_images` (
    `id` BIGINT(20) PRIMARY KEY AUTO_INCREMENT NOT NULL,
    `tenant_id` BIGINT(20) UNSIGNED NOT NULL,
    `category_id` INT(11) DEFAULT NULL,
    `filename` varchar(191) DEFAULT NULL,
    `original_file_name` varchar(191) DEFAULT NULL,	
    `file_for` varchar(191) DEFAULT NULL,
    `added_on` datetime DEFAULT NULL,
    `updated_on` datetime DEFAULT NULL,
    KEY `tenant_id` (`tenant_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

INSERT INTO tblplan_features (name, codename, description,type,added_on) 
VALUES('Contractor+ Free Website', 'cp_free_website', 'Contractor+ Free Website','restrict',UTC_TIMESTAMP());

SET @plans_features_id = LAST_INSERT_ID();
INSERT INTO tblplan_features_value (plans_id, plans_features_id, value,other_data,added_on) 
VALUES(9, @plans_features_id, 0,'{"outside_message":"Contractor+ Free Website is a pro feature, in order to use it Upgrade to PRO","inside_message":"Contractor+ Free Website is a pro feature, in order to use it Upgrade to PRO","tag_color":"#eb0e0e","tag_title":"PRO","link":"https:\/\/my.contractorplus.app\/","count":"0"}',UTC_TIMESTAMP()),
(10, @plans_features_id, 1,NULL,UTC_TIMESTAMP()),
(11, @plans_features_id, 1,NULL,UTC_TIMESTAMP()),
(12, @plans_features_id, 1,NULL,UTC_TIMESTAMP()),
(13, @plans_features_id, 0,'{"outside_message":"Contractor+ Free Website is a pro feature, in order to use it Upgrade to PRO","inside_message":"Contractor+ Free Website is a pro feature, in order to use it Upgrade to PRO","tag_color":"#eb0e0e","tag_title":"PRO","link":"https:\/\/my.contractorplus.app\/","count":"0"}',UTC_TIMESTAMP()),
(14, @plans_features_id, 1,NULL,UTC_TIMESTAMP()),
(15, @plans_features_id, 1,NULL,UTC_TIMESTAMP());

INSERT INTO tblplan_features (name, codename, description,type,added_on) 
VALUES('Contractor+ Free Website Custom Domain', 'cp_free_website_custom_domain', 'Contractor+ Free Website Custom Domain','restrict',UTC_TIMESTAMP());

SET @plans_features_id = LAST_INSERT_ID();
INSERT INTO tblplan_features_value (plans_id, plans_features_id, value,other_data,added_on) 
VALUES(9, @plans_features_id, 0,'{"outside_message":"Contractor+ Free Website Custom Domain is a ultimate feature, in order to use it Upgrade to ULTIMATE","inside_message":"Contractor+ Free Website is a ultimate feature, in order to use it Upgrade to ULTIMATE","tag_color":"#eb0e0e","tag_title":"ULTIMATE","link":"https:\/\/my.contractorplus.app\/","count":"0"}',UTC_TIMESTAMP()),
(10, @plans_features_id, 0,'{"outside_message":"Contractor+ Free Website Custom Domain is a ultimate feature, in order to use it Upgrade to ULTIMATE","inside_message":"Contractor+ Free Website is a ultimate feature, in order to use it Upgrade to ULTIMATE","tag_color":"#eb0e0e","tag_title":"ULTIMATE","link":"https:\/\/my.contractorplus.app\/","count":"0"}',UTC_TIMESTAMP()),
(11, @plans_features_id, 0,'{"outside_message":"Contractor+ Free Website Custom Domain is a ultimate feature, in order to use it Upgrade to ULTIMATE","inside_message":"Contractor+ Free Website is a ultimate feature, in order to use it Upgrade to ULTIMATE","tag_color":"#eb0e0e","tag_title":"ULTIMATE","link":"https:\/\/my.contractorplus.app\/","count":"0"}',UTC_TIMESTAMP()),
(12, @plans_features_id, 1,NULL,UTC_TIMESTAMP()),
(13, @plans_features_id, 0,'{"outside_message":"Contractor+ Free Website Custom Domain is a ultimate feature, in order to use it Upgrade to ULTIMATE","inside_message":"Contractor+ Free Website is a ultimate feature, in order to use it Upgrade to ULTIMATE","tag_color":"#eb0e0e","tag_title":"ULTIMATE","link":"https:\/\/my.contractorplus.app\/","count":"0"}',UTC_TIMESTAMP()),
(14, @plans_features_id, 0,'{"outside_message":"Contractor+ Free Website Custom Domain is a ultimate feature, in order to use it Upgrade to ULTIMATE","inside_message":"Contractor+ Free Website is a ultimate feature, in order to use it Upgrade to ULTIMATE","tag_color":"#eb0e0e","tag_title":"ULTIMATE","link":"https:\/\/my.contractorplus.app\/","count":"0"}',UTC_TIMESTAMP()),
(15, @plans_features_id, 1,NULL,UTC_TIMESTAMP());

INSERT INTO tbltrial_details (module, no_of_trial_days, module_live_date,details,addedon) 
VALUES('cp_free_website',15,'2023-06-27', '{"trial_active_details":{"icon":"assets\/images\/trial_icons\/trial_active.png","title":"Contractor+ Free Website (Trial)","description":"Contractor+ Free Website is a PRO feature. You have {no_of_trial_days_left} left on your free trial, after that, you\'ll need to choose a plan.","button_text":"UPGRADE PLAN"},"trial_expired_detials":{"icon":"assets\/images\/trial_icons\/trial_expired.png","title":"Trial Expired!","description":"Your trial of Contractor+ Free Website Module has expired. To continue using Contractor+ Free Website Module, choose a PRO plan now.","button_text":"UPGRADE PLAN"}}', '2023-06-27');

ALTER TABLE `tbltenant_free_website_config` ADD `config_completed_on` datetime DEFAULT NULL;

INSERT INTO `tblapad_options`
  (`type`, `name`, `value`, `autoload`)
  VALUES (NULL, 'free_website_recaptcha_site_key', '6LemZDwnAAAAAP1JpkndvCGkhbRe9ccAd4l0JKoh', 1),
  (NULL, 'free_website_recaptcha_secret_key', '6LemZDwnAAAAANmDtdt3DP9Lrl_7FmgBVGYFFpJL', 1);


