-- Initial Schema for Event Management App

-- Venues Table: Stores information about event locations.
CREATE TABLE IF NOT EXISTS `venues` (
  `id` INT PRIMARY KEY AUTO_INCREMENT,
  `name` VARCHAR(255) NOT NULL,
  `description` TEXT,
  `capacity` INT,
  `address` VARCHAR(255),
  `is_available` BOOLEAN DEFAULT TRUE,
  `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- Vendors Table: Stores information about service providers.
CREATE TABLE IF NOT EXISTS `vendors` (
  `id` INT PRIMARY KEY AUTO_INCREMENT,
  `name` VARCHAR(255) NOT NULL,
  `service_type` VARCHAR(100) COMMENT '''e.g., Catering, Decor, Entertainment''',
  `contact_email` VARCHAR(255),
  `contact_phone` VARCHAR(20),
  `rating` DECIMAL(3, 2) COMMENT '''Rating from 1.00 to 5.00''',
  `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- Users Table: For authentication and roles.
CREATE TABLE IF NOT EXISTS `users` (
  `id` INT PRIMARY KEY AUTO_INCREMENT,
  `email` VARCHAR(255) NOT NULL UNIQUE,
  `password_hash` VARCHAR(255) NOT NULL,
  `role` VARCHAR(50) NOT NULL DEFAULT '''event_manager''' COMMENT '''e.g., event_manager, admin''',
  `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
