-- GDS Connections table
CREATE TABLE IF NOT EXISTS `gds_connections` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `agency_id` bigint unsigned NOT NULL,
  `name` varchar(255) NOT NULL,
  `gds_source` enum('amadeus','sabre','travelport') NOT NULL,
  `api_key` varchar(500) DEFAULT '',
  `api_secret` varchar(500) DEFAULT '',
  `username` varchar(255) DEFAULT '',
  `password` varchar(255) DEFAULT '',
  `target_branch` varchar(100) DEFAULT '',
  `target_city` varchar(100) DEFAULT '',
  `test_mode` tinyint(1) DEFAULT 1,
  `is_active` tinyint(1) DEFAULT 1,
  `last_sync` datetime DEFAULT NULL,
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `agency_id` (`agency_id`),
  KEY `gds_source` (`gds_source`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- GDS API Logs
CREATE TABLE IF NOT EXISTS `gds_api_logs` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `agency_id` bigint unsigned NOT NULL,
  `gds_source` varchar(50) DEFAULT NULL,
  `request_type` varchar(100) DEFAULT NULL,
  `request_data` text,
  `response_data` text,
  `status` varchar(20) DEFAULT 'pending',
  `created_at` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `agency_id` (`agency_id`),
  KEY `gds_source` (`gds_source`),
  KEY `status` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
