-- VoiceChat App MySQL Database Schema

CREATE TABLE IF NOT EXISTS `users` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL,
  `email` varchar(100) NOT NULL,
  `password` varchar(255) NOT NULL,
  `role` enum('user','host','admin') DEFAULT 'user',
  `coin_balance` int(11) DEFAULT 0,
  `created_at` timestamp DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `email` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- Pre-populate an Admin user (Password: admin123)
-- In production, make sure to change this or use secure hashes.
INSERT INTO `users` (`name`, `email`, `password`, `role`, `coin_balance`) VALUES
('Admin', 'admin@voicechat.com', '$2y$10$Y1s1Z7q/YV4iR8XqW1tM2e/1H/Q9vR/9Gq3oYQ/5Yw.7rQ.7rQ.7r', 'admin', 99999);
