INSERT INTO request_types (id, name, code) VALUES
	(6, 'Roaming Data', 'roaming_data');

CREATE TABLE roaming_data_devices (
	id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
	name VARCHAR(255) NOT NULL,
	code VARCHAR(32) NOT NULL UNIQUE,
	active TINYINT(1) NOT NULL DEFAULT 1
) ENGINE=InnoDB;

CREATE TABLE roaming_data_data_plans (
	id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
	cost DECIMAL(7,2) NOT NULL,
	included_allowance DECIMAL(7,2) NOT NULL,
	active TINYINT(1) NOT NULL DEFAULT 1
) ENGINE=InnoDB;

CREATE TABLE roaming_data_requests (
	id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
	request_id INT NOT NULL,
	device_type_id INT NOT NULL,
	phone_number VARCHAR(16) NOT NULL,
	data_plan_id INT NOT NULL,
	approver_service_number INT NOT NULL,
	FOREIGN KEY idx_request (request_id) REFERENCES requests (id),
	FOREIGN KEY idx_device (device_type_id) REFERENCES roaming_data_devices (id),
	FOREIGN KEY idx_data_plan (data_plan_id) REFERENCES roaming_data_data_plans (id),
	FOREIGN KEY idx_approver (approver_service_number) REFERENCES users (service_number)
) ENGINE=InnoDB;

INSERT INTO roaming_data_devices (id, name, code) VALUES
	(1, 'Mobile Phone', 'mobile'),
	(2, 'iPad', 'ipad'),
	(3, 'Broadband Card', 'broadband_card');

INSERT INTO roaming_data_data_plans (id, cost, included_allowance) VALUES
	(1, 29, 150),
	(2, 85, 450),
	(3, 160, 900),
	(4, 350, 2250),
	(5, 550, 3750),
	(6, 1050, 7500),
	(7, 1800, 15000);
