CREATE TABLE IF NOT EXISTS users (
    id INT AUTO_INCREMENT PRIMARY KEY,
    fullname VARCHAR(100) NOT NULL,
    username VARCHAR(50) NOT NULL UNIQUE,
    password VARCHAR(255) NOT NULL
);

CREATE TABLE IF NOT EXISTS appointments (
    id INT AUTO_INCREMENT PRIMARY KEY,
    customer_name VARCHAR(100) NOT NULL,
    phone VARCHAR(20) NOT NULL,
    service VARCHAR(100) NOT NULL,
    appointment_date DATE NOT NULL,
    appointment_time TIME NOT NULL
);

-- Demo user: username admin, password 1234
INSERT INTO users (fullname, username, password)
SELECT 'Administrator', 'admin', '$2y$10$D2XUlgEbKzk09SV9UQMH.uIWXS.kPpXU4SoZXY0nbyi0PCx9X6yJS'
WHERE NOT EXISTS (SELECT 1 FROM users WHERE username = 'admin');
