-- Tabla para las API keys
CREATE TABLE IF NOT EXISTS `api_keys` (
  `id`           INT AUTO_INCREMENT PRIMARY KEY,
  `userid`       BIGINT NOT NULL,
  `api_key`      VARCHAR(64) NOT NULL UNIQUE,
  `status`       ENUM('active','inactive') DEFAULT 'active',
  `last_request` INT DEFAULT 0,
  `total_calls`  INT DEFAULT 0,
  `created_at`   DATETIME DEFAULT NOW(),
  KEY `idx_api_key` (`api_key`),
  KEY `idx_userid`  (`userid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- Ejemplo: crear una key manualmente
-- INSERT INTO api_keys (userid, api_key) VALUES (6319087504, '888ELITE_KEY_DEMO_001');
