CREATE TABLE `customers` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `mobile` varchar(11) NOT NULL COMMENT 'Format: 09xxxxxxxxx',
  `first_name` varchar(50) NOT NULL,
  `last_name` varchar(50) NOT NULL,
  `national_code` varchar(10) DEFAULT NULL COMMENT 'Iranian National ID',
  `employee_code` varchar(20) DEFAULT NULL COMMENT '┌®Ï» ┘à┘åÏ¡ÏÁÏ▒ Ï¿┘ç ┘üÏ▒Ï» ┘ç┘à┌®ÏºÏ▒ (EMP-XXXX) - Ï¬┘å┘çÏº Ï¿Ï▒Ïº█î ┘ç┘à┌®ÏºÏ▒Ïº┘å█î ┌®┘ç user_type=partner Ï»ÏºÏ▒┘åÏ»',
  `accepts_used_battery` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Partner purchases with used battery trade-in by default',
  `email` varchar(100) DEFAULT NULL,
  `user_type` enum('customer','partner') NOT NULL DEFAULT 'customer',
  `status` enum('active','inactive','suspended') NOT NULL DEFAULT 'active',
  `cod_allowed` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Can use Cash on Delivery',
  `cod_blocked_reason` text DEFAULT NULL,
  `created_at` datetime NOT NULL DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
  `last_login_at` datetime DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_mobile` (`mobile`),
  UNIQUE KEY `uk_national_code` (`national_code`),
  UNIQUE KEY `uk_employee_code` (`employee_code`),
  KEY `idx_status` (`status`),
  KEY `idx_user_type` (`user_type`),
  KEY `idx_user_type_employee` (`user_type`,`employee_code`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
