DELETE FROM ThemeSettings;
DELETE FROM Themes;
DELETE FROM Rules;
DELETE FROM Timers;
DELETE FROM Resources;
DELETE FROM Devices;
DELETE FROM Spaces;
DELETE FROM Sites;
DELETE FROM Users;
INSERT INTO Users (ID, Email, FirstName, LastName, PasswordHash, CreatedOn, phone_number) VALUES ('340', 'hamza.ali@kics.edu.pk', 'Hamza', 'Ali', '4C22F642F7E89B0D5051B7D7DF6484449D693BA0', '2022-10-24 12:36:26', '92 3244772082');
INSERT INTO Sites (ID, Title, Description, UserID, CreatedOn) VALUES (185, 'Home Access', ' ', 340, '2022-10-24 12:37:18');
INSERT INTO Spaces (ID, Title, Description, SiteID, CreatedOn) VALUES (441, 'Balcony', ' ', 185, '2022-10-24 12:42:04');
INSERT INTO Devices (ID, Title, Description, SpaceID, CategoryID, RegisteredOn, ModelID) VALUES (4591, 'Device Hamza', ' ', 441, 2, '2022-10-24 12:44:05', '47');
INSERT INTO Resources (ID, Title, DeviceID, AccessoryID, ApplianceType, CurrentStatus, IsFavorite, ApplianceWatt) VALUES (55244, 'Switch 1', 4591, 1, 0, 0, 0, 0);
INSERT INTO Resources (ID, Title, DeviceID, AccessoryID, ApplianceType, CurrentStatus, IsFavorite, ApplianceWatt) VALUES (55245, 'Switch 2', 4591, 2, 0, 0, 0, 0);
INSERT INTO Resources (ID, Title, DeviceID, AccessoryID, ApplianceType, CurrentStatus, IsFavorite, ApplianceWatt) VALUES (55246, 'Switch 3', 4591, 3, 0, 0, 0, 0);
INSERT INTO Resources (ID, Title, DeviceID, AccessoryID, ApplianceType, CurrentStatus, IsFavorite, ApplianceWatt) VALUES (55247, 'Switch 4', 4591, 4, 0, 0, 0, 0);
INSERT INTO Resources (ID, Title, DeviceID, AccessoryID, ApplianceType, CurrentStatus, IsFavorite, ApplianceWatt) VALUES (55248, 'Switch 5', 4591, 5, 0, 0, 0, 0);
INSERT INTO Resources (ID, Title, DeviceID, AccessoryID, ApplianceType, CurrentStatus, IsFavorite, ApplianceWatt) VALUES (55249, 'Dimmer 1', 4591, 6, 0, 0, 0, 0);
UPDATE Resources SET Title = 'Switch 1', ApplianceType = 3, ApplianceWatt = 50 WHERE ID = 55244;
UPDATE Resources SET Title = 'Switch 2', ApplianceType = 1, ApplianceWatt = 33 WHERE ID = 55245;
UPDATE Resources SET Title = 'Switch 3', ApplianceType = 2, ApplianceWatt = 85 WHERE ID = 55246;
UPDATE Resources SET Title = 'Switch 4', ApplianceType = 5, ApplianceWatt = 69 WHERE ID = 55247;
UPDATE Resources SET Title = 'Switch 5', ApplianceType = 8, ApplianceWatt = 66 WHERE ID = 55248;
UPDATE Resources SET Title = 'Dimmer 1', ApplianceType = 4, ApplianceWatt = 160 WHERE ID = 55249;
INSERT INTO Devices (ID, Title, Description, SpaceID, CategoryID, RegisteredOn, ModelID) VALUES (4763, 'Ir Device', ' ', 441, 4, '2022-10-24 12:53:26', '51');
INSERT INTO IR_Model (ID, Title, Vendor_ID, Protocol_ID) VALUES ('1929', 'Changhong Ruba 40 Inch FHD LED TV (40F3808M)', '39', '19');
INSERT INTO IR_Remote (ID, title, Vendor_ID, Protocol_ID, Model_ID, Type, User_ID, site_id, space_id, dev_id) VALUES ('96', 'ac remote', '39', '19', '1929', '2', '340', '185', '441', '4763');
INSERT INTO IR_Model (ID, Title, Vendor_ID, Protocol_ID) VALUES ('1967', 'LG 65 Inch UHD LED TV (65SJ800V)', '48', '13');
INSERT INTO IR_Remote (ID, title, Vendor_ID, Protocol_ID, Model_ID, Type, User_ID, site_id, space_id, dev_id) VALUES ('97', 'tv', '48', '13', '1967', '2', '340', '185', '441', '4763');
INSERT INTO Themes (ID, Title, Description, ThemeType, SiteID, CreatedOn) VALUES (409, 'Theme 1', ' ', 1, 185, '2022-10-24 12:55:28');
INSERT INTO ThemeSettings (ID, ThemeID, ResourceID, TargetValue) VALUES (4811, 409, 55244, 1);
INSERT INTO ThemeSettings (ID, ThemeID, ResourceID, TargetValue) VALUES (4812, 409, 55245, 0);
INSERT INTO ThemeSettings (ID, ThemeID, ResourceID, TargetValue) VALUES (4813, 409, 55246, 1);
INSERT INTO ThemeSettings (ID, ThemeID, ResourceID, TargetValue) VALUES (4814, 409, 55247, 1);
INSERT INTO ThemeSettings (ID, ThemeID, ResourceID, TargetValue) VALUES (4815, 409, 55248, 0);
INSERT INTO ThemeSettings (ID, ThemeID, ResourceID, TargetValue) VALUES (4816, 409, 55249, 0);
INSERT INTO Themes (ID, Title, Description, ThemeType, StartTime, EndTime, SiteID, CreatedOn) VALUES (410, 'Time Based Theme', ' ', 2, '12:56', '13:4', 185, '2022-10-24 12:56:51');
INSERT INTO ThemeSettings (ID, ThemeID, ResourceID, TargetValue) VALUES (4817, 410, 55244, 1);
INSERT INTO ThemeSettings (ID, ThemeID, ResourceID, TargetValue) VALUES (4818, 410, 55245, 1);
INSERT INTO ThemeSettings (ID, ThemeID, ResourceID, TargetValue) VALUES (4819, 410, 55246, 0);
INSERT INTO ThemeSettings (ID, ThemeID, ResourceID, TargetValue) VALUES (4820, 410, 55247, 0);
INSERT INTO ThemeSettings (ID, ThemeID, ResourceID, TargetValue) VALUES (4821, 410, 55248, 1);
INSERT INTO ThemeSettings (ID, ThemeID, ResourceID, TargetValue) VALUES (4822, 410, 55249, 4);
DELETE FROM IR_Remote WHERE ID = '97';
DELETE FROM IR_Model WHERE ID = '1967';
DELETE FROM IR_Remote WHERE ID = '96';
DELETE FROM IR_Model WHERE ID = '1929';
DELETE FROM IR_Remote r WHERE r.User_ID = 340 AND r.dev_id = 4763;
DELETE FROM Resources WHERE DeviceID  = 4763;
DELETE FROM Devices WHERE ID = 4763;
DELETE FROM ThemeSettings WHERE ResourceID IN (SELECT ID FROM Resources WHERE DeviceID = 4591);
DELETE FROM Themes WHERE ID = 409;
DELETE FROM Themes WHERE ID = 410;
DELETE FROM Timers WHERE ResourceID IN (SELECT ID FROM Resources WHERE DeviceID = 4591);
DELETE FROM Resources WHERE DeviceID  = 4591;
DELETE FROM Devices WHERE ID = 4591;
