CREATE TABLE `order_used_batteries` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `order_id` int(10) unsigned NOT NULL COMMENT 'Parent order',
  `order_item_id` bigint(20) unsigned NOT NULL COMMENT 'The order item this battery is for',
  `declared_amperage` int(10) unsigned NOT NULL DEFAULT 0 COMMENT 'Amperage declared by customer',
  `actual_amperage` int(10) unsigned NULL DEFAULT NULL COMMENT 'Amperage confirmed on receipt (null = pending)',
  `used_rate` int(10) unsigned NOT NULL DEFAULT 0 COMMENT 'Rate per ampere (Rials)',
  `status` enum('pending','received_exact','received_less','received_more','rejected') NOT NULL DEFAULT 'pending',
  `received_at` datetime NULL DEFAULT NULL,
  `received_by` int(10) unsigned NULL DEFAULT NULL COMMENT 'Admin user ID',
  `rejection_reason` varchar(500) NULL DEFAULT NULL,
  `created_at` datetime NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `idx_order_id` (`order_id`),
  KEY `idx_order_item_id` (`order_item_id`),
  KEY `idx_status` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
