[
  {
    "type": "alter_table",
    "description": "Add mappedRole column to employees table for BuyerKiosk role assignment",
    "database": "{{store}}",
    "check_query": "SHOW COLUMNS FROM employees LIKE 'mappedRole'",
    "sql": "ALTER TABLE `employees` ADD COLUMN `mappedRole` ENUM('buyer', 'sorter', 'manager', 'associate', 'shift_lead') DEFAULT NULL COMMENT 'BuyerKiosk role mapped from WhenIWork position' AFTER `position`"
  },
  {
    "type": "alter_table",
    "description": "Add roleColor column to employees table for custom role color display",
    "database": "{{store}}",
    "check_query": "SHOW COLUMNS FROM employees LIKE 'roleColor'",
    "sql": "ALTER TABLE `employees` ADD COLUMN `roleColor` VARCHAR(7) DEFAULT NULL COMMENT 'Hex color for role display (e.g., #3b82f6)' AFTER `mappedRole`"
  },
  {
    "type": "create_table",
    "description": "Create wiwPositionRoleMap table for mapping WhenIWork positions to BuyerKiosk roles",
    "database": "{{store}}",
    "check_query": "SHOW TABLES LIKE 'wiwPositionRoleMap'",
    "sql": "CREATE TABLE `wiwPositionRoleMap` (`id` INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, `position` VARCHAR(100) NOT NULL COMMENT 'WhenIWork position name', `mappedRole` ENUM('buyer', 'sorter', 'manager', 'associate', 'shift_lead') NOT NULL DEFAULT 'associate' COMMENT 'BuyerKiosk role', `roleColor` VARCHAR(7) DEFAULT NULL COMMENT 'Custom hex color (null = use default)', `createdAt` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, `updatedAt` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, UNIQUE KEY `uk_position` (`position`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Maps WhenIWork position names to BuyerKiosk roles'"
  },
  {
    "type": "raw_sql",
    "description": "Seed default position mappings for common WhenIWork positions",
    "database": "{{store}}",
    "sql": "INSERT IGNORE INTO wiwPositionRoleMap (position, mappedRole) VALUES ('Buyer', 'buyer'), ('Sorter', 'sorter'), ('Manager', 'manager'), ('Shift Lead', 'shift_lead'), ('Associate', 'associate'), ('Cashier', 'associate'), ('Sales Associate', 'associate'), ('Floor', 'associate')"
  }
]
