-- Create the callback_logs table for pay2inrsql database
-- This table stores outgoing callback/webhook logs sent to merchant callback URLs

CREATE TABLE IF NOT EXISTS `callback_logs` (
  `id` INT(11) NOT NULL AUTO_INCREMENT,
  `order_id` VARCHAR(100) NOT NULL,
  `user_name` VARCHAR(100) DEFAULT NULL,
  `callback_url` TEXT DEFAULT NULL,
  `amount` DECIMAL(12,2) DEFAULT 0.00,
  `txn_status` VARCHAR(50) DEFAULT NULL,
  `utr_number` VARCHAR(100) DEFAULT NULL,
  `api_txn_id` VARCHAR(100) DEFAULT NULL,
  `received_from` VARCHAR(50) DEFAULT NULL,
  `sent_data` TEXT DEFAULT NULL,
  `response` TEXT DEFAULT NULL,
  `http_code` INT(11) DEFAULT 0,
  `status` VARCHAR(20) DEFAULT NULL,
  `error_message` TEXT DEFAULT NULL,
  `created_at` DATETIME DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_order_id` (`order_id`),
  KEY `idx_user_name` (`user_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
