CREATE TABLE IF NOT EXISTS users (
  id            INT AUTO_INCREMENT PRIMARY KEY,
  email         VARCHAR(255) NOT NULL UNIQUE,
  display_name  VARCHAR(100) NOT NULL,
  google_id     VARCHAR(100) UNIQUE DEFAULT NULL,
  role          ENUM('admin', 'analyst', 'viewer') DEFAULT 'analyst',
  is_allowed    TINYINT(1) DEFAULT 0,
  last_login    DATETIME DEFAULT NULL,
  created_at    TIMESTAMP DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- Seed allowed users
INSERT IGNORE INTO users (email, display_name, role, is_allowed) VALUES
  ('yaritza@sunbright.com', 'Yaritza Rivera', 'admin', 1),
  ('catalina@sunbright.com', 'Catalina Cardenas', 'analyst', 1);
