DROP TABLE IF EXISTS [db_prefix]sms_notification_message_statuses;
CREATE TABLE [db_prefix]sms_notification_message_statuses (
  id int(11) NOT NULL default '0',
  description varchar(255) NOT NULL default '',
  detail varchar(255) NOT NULL default '',
  error_flag enum('0','1') NOT NULL default '0',
  PRIMARY KEY  (id)
) CHARSET=utf8;

INSERT INTO [db_prefix]sms_notification_message_statuses VALUES (1, 'Message unknown', 'The message ID is incorrect or reporting is delayed', '1');
INSERT INTO [db_prefix]sms_notification_message_statuses VALUES (2, 'Message queued', 'The message could not be delivered and has been queued for attempted redelivery', '1');
INSERT INTO [db_prefix]sms_notification_message_statuses VALUES (3, 'Delivered to gateway', 'Delivered to the upstream gateway or network (delivered to the recipient)', '0');
INSERT INTO [db_prefix]sms_notification_message_statuses VALUES (4, 'Received by recipient', 'Confirmation of receipt on the handset of the recipient', '0');
INSERT INTO [db_prefix]sms_notification_message_statuses VALUES (5, 'Error with message', 'There was an error with the message, probably caused by the content of the message itself', '1');
INSERT INTO [db_prefix]sms_notification_message_statuses VALUES (6, 'User cancelled message delivery', 'The message was terminated by a user (stop', '1');
INSERT INTO [db_prefix]sms_notification_message_statuses VALUES (7, 'Error delivering message', 'An error occurred delivering the message to the', '1');
INSERT INTO [db_prefix]sms_notification_message_statuses VALUES (8, 'OK', 'Message received by gateway', '0');
INSERT INTO [db_prefix]sms_notification_message_statuses VALUES (9, 'Routing error', 'The routing gateway or network has had an error routing the message', '1');
INSERT INTO [db_prefix]sms_notification_message_statuses VALUES (10, 'Message expired', 'Message has expired before we were able to deliver it to the upstream gateway. No charge applies', '1');
INSERT INTO [db_prefix]sms_notification_message_statuses VALUES (11, 'Message queued for later delivery', 'Message has been queued at the gateway for delivery at a later time (delayed delivery)', '0');
INSERT INTO [db_prefix]sms_notification_message_statuses VALUES (12, 'Out of credit', 'The message cannot be delivered due to a lack of funds in your account. Please re-purchase credits', '1');

DROP TABLE IF EXISTS [db_prefix]sms_notification_prices;
CREATE TABLE [db_prefix]sms_notification_prices (
  id int(11) NOT NULL auto_increment,
  sms_packet int(5) NOT NULL default '0',
  cost double NOT NULL default '0',
  PRIMARY KEY  (id)
) CHARSET=utf8;

INSERT INTO [db_prefix]sms_notification_prices VALUES (1, 10, 8);
INSERT INTO [db_prefix]sms_notification_prices VALUES (2, 25, 19);
INSERT INTO [db_prefix]sms_notification_prices VALUES (3, 50, 37);
INSERT INTO [db_prefix]sms_notification_prices VALUES (4, 100, 70);

DROP TABLE IF EXISTS [db_prefix]sms_notification_sended;
CREATE TABLE [db_prefix]sms_notification_sended (
  id int(11) NOT NULL auto_increment,
  id_user int(11) NOT NULL default '0',
  id_subscribe tinyint(4) NOT NULL default '0',
  sms_text varchar(255) NOT NULL default '',
  api_msg_id varchar(127) NOT NULL default '0',
  error_msg varchar(127) NOT NULL default '',
  from_sa varchar(127) default NULL,
  delay int(5) default NULL,
  use_flash enum('0','1') NOT NULL default '0',
  date_send datetime NOT NULL default '0000-00-00 00:00:00',
  PRIMARY KEY  (id)
) CHARSET=utf8;

DROP TABLE IF EXISTS [db_prefix]sms_notification_settings;
CREATE TABLE [db_prefix]sms_notification_settings (
  id int(5) NOT NULL default '0',
  name varchar(255) NOT NULL default '',
  value varchar(255) NOT NULL default '',
  PRIMARY KEY  (id)
) CHARSET=utf8;


INSERT INTO [db_prefix]sms_notification_settings VALUES (1, 'use', '1');
INSERT INTO [db_prefix]sms_notification_settings VALUES (2, 'clck_username', 'UserName');
INSERT INTO [db_prefix]sms_notification_settings VALUES (3, 'clck_api_id', '0000000');
INSERT INTO [db_prefix]sms_notification_settings VALUES (4, 'clck_password', '');
INSERT INTO [db_prefix]sms_notification_settings VALUES (5, 'unicode', '0');
INSERT INTO [db_prefix]sms_notification_settings VALUES (6, 'use_source_address', '1');
INSERT INTO [db_prefix]sms_notification_settings VALUES (7, 'source_address', 'sender id');
INSERT INTO [db_prefix]sms_notification_settings VALUES (8, 'use_delivery_time', '0');
INSERT INTO [db_prefix]sms_notification_settings VALUES (9, 'delivery_time', '1');
INSERT INTO [db_prefix]sms_notification_settings VALUES (10, 'use_flash_sms', '0');
INSERT INTO [db_prefix]sms_notification_settings VALUES (11, 'clck_only_usa', '0');
INSERT INTO [db_prefix]sms_notification_settings VALUES (12, 'clck_number', '');

DROP TABLE IF EXISTS [db_prefix]sms_notification_subscribe;
CREATE TABLE [db_prefix]sms_notification_subscribe (
  id int(3) NOT NULL auto_increment,
  description varchar(255) NOT NULL default '',
  status enum('0','1') NOT NULL default '0',
  sms_text varchar(255) NOT NULL default '',
  PRIMARY KEY  (id)
) CHARSET=utf8;

INSERT INTO [db_prefix]sms_notification_subscribe VALUES (1, 'perfect_match_user', '1', 'Hello, {USER_NAME}. New matching variants on {SITE_NAME}!');
INSERT INTO [db_prefix]sms_notification_subscribe VALUES (2, 'new_message', '1', 'Hello, {USER_NAME}. New message  on {SITE_NAME}!');
INSERT INTO [db_prefix]sms_notification_subscribe VALUES (3, 'viewed_my_profile', '1', 'Hello, {USER_NAME}. Your profile was viewed on {SITE_NAME}!');

DROP TABLE IF EXISTS [db_prefix]sms_notification_user_balance;
CREATE TABLE [db_prefix]sms_notification_user_balance (
  id int(11) NOT NULL auto_increment,
  id_user int(11) NOT NULL default '0',
  sms_balance int(11) NOT NULL default '0',
  date_refresh datetime NOT NULL default '0000-00-00 00:00:00',
  phone varchar(15) NOT NULL default '',
  PRIMARY KEY  (id),
  KEY id_user (id_user)
) CHARSET=utf8;

DROP TABLE IF EXISTS [db_prefix]sms_notification_user_event;
CREATE TABLE [db_prefix]sms_notification_user_event (
  id int(11) NOT NULL auto_increment,
  id_subscribe int(3) NOT NULL default '0',
  id_user int(11) NOT NULL default '0',
  PRIMARY KEY  (id),
  KEY id_subscribe (id_subscribe),
  KEY id_user (id_user)
) CHARSET=utf8;