CREATE DATABASE office_booking;

USE office_booking;

CREATE TABLE users (
    id INT AUTO_INCREMENT PRIMARY KEY,
    username VARCHAR(255) NOT NULL UNIQUE,
    password VARCHAR(255) NOT NULL,
    email VARCHAR(255) NOT NULL UNIQUE
);

CREATE TABLE offices (
    id INT AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(255) NOT NULL,
    description TEXT,
    capacity INT,
    location VARCHAR(255),
    size INT,
    price_per_week DECIMAL(10, 2)
);

CREATE TABLE bookings (
    id INT AUTO_INCREMENT PRIMARY KEY,
    office_id INT,
    user_id INT,
    start_time DATETIME,
    end_time DATETIME,
    total_price DECIMAL(10, 2),
    payment_status ENUM('pending', 'paid') DEFAULT 'pending',
    FOREIGN KEY (office_id) REFERENCES offices(id),
    FOREIGN KEY (user_id) REFERENCES users(id)
);
