CREATE TABLE IF NOT EXISTS `wizard_steps` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `parent_id` int(11) DEFAULT NULL,
  `label_pl` varchar(255) NOT NULL,
  `label_en` varchar(255) NOT NULL,
  `is_final` tinyint(1) DEFAULT 0,
  `ticket_type` varchar(10) DEFAULT NULL COMMENT 'INC or REQ',
  PRIMARY KEY (`id`),
  KEY `parent_id` (`parent_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Table structure for table `wizard_users`
--
CREATE TABLE IF NOT EXISTS `wizard_users` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `email` varchar(255) NOT NULL,
  `totp_secret` varchar(32) DEFAULT NULL,
  `preferred_method` enum('totp','email') DEFAULT NULL,
  `email_code` varchar(6) DEFAULT NULL,
  `email_code_expires` datetime DEFAULT NULL,
  `attempts` int(11) DEFAULT 0,
  `lockout_until` datetime DEFAULT NULL,
  `is_active` tinyint(1) DEFAULT 1,
  `is_admin` tinyint(1) DEFAULT 0,
  PRIMARY KEY (`id`),
  UNIQUE KEY `email` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- Sample Data (Optional, for structure visualization)
-- INSERT INTO `wizard_steps` (`parent_id`, `label_pl`, `label_en`, `is_final`, `ticket_type`) VALUES
-- (NULL, 'Sprzęt', 'Hardware', 0, NULL),
-- (NULL, 'Oprogramowanie', 'Software', 0, NULL),
-- (1, 'Komputer', 'Computer', 0, NULL),
-- (1, 'Drukarka', 'Printer', 0, NULL),
-- (3, 'Nie włącza się', 'Won\'t turn on', 1, 'INC'),
-- (3, 'Wolno działa', 'Performance issues', 1, 'INC');
