-- DentalCare v0.5.9.8.69
-- Android phone/SIM SMS gateway readiness (TextBee-compatible provider configuration).

INSERT INTO `{{prefix}}settings` (`group_name`,`setting_key`,`setting_value`,`is_secret`,`created_at`,`updated_at`) VALUES
('sms','android_gateway_url','',1,NOW(),NOW()),
('sms','android_gateway_api_key','',1,NOW(),NOW()),
('sms','android_gateway_device_id','',1,NOW(),NOW()),
('sms','android_gateway_header_name','x-api-key',0,NOW(),NOW()),
('system','sms_android_gateway_ready','1',0,NOW(),NOW())
ON DUPLICATE KEY UPDATE
  `setting_value`=IF(`setting_key`='sms_android_gateway_header_name' AND (`setting_value` IS NULL OR `setting_value`=''),VALUES(`setting_value`),`setting_value`),
  `is_secret`=VALUES(`is_secret`),
  `updated_at`=NOW();

UPDATE `{{prefix}}settings`
SET `setting_value`='1',`updated_at`=NOW()
WHERE `group_name`='system' AND `setting_key`='sms_readiness_ready';
