CREATE TABLE IF NOT EXISTS destinations (
    id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(100) NOT NULL,
    image VARCHAR(255),
    slug VARCHAR(100),
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

CREATE TABLE IF NOT EXISTS categories (
    id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(100) NOT NULL,
    image VARCHAR(255),
    slug VARCHAR(100),
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

CREATE TABLE IF NOT EXISTS packages (
    id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    title VARCHAR(255) NOT NULL,
    destination_id INT(6) UNSIGNED,
    category_id INT(6) UNSIGNED,
    price DECIMAL(10, 2),
    duration VARCHAR(50),
    image VARCHAR(255),
    description TEXT,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    FOREIGN KEY (destination_id) REFERENCES destinations(id),
    FOREIGN KEY (category_id) REFERENCES categories(id)
);

-- Insert Dummy Data for Destinations
INSERT INTO destinations (name, image, slug) VALUES 
('Bali', 'https://images.unsplash.com/photo-1537996194471-e657df975ab4', 'bali'),
('Dubai', 'https://images.unsplash.com/photo-1512453979798-5ea904ac6605', 'dubai'),
('Singapore', 'https://images.unsplash.com/photo-1525625293386-3f8f99389edd', 'singapore'),
('Thailand', 'https://images.unsplash.com/photo-1552465011-b4e21bf6e79a', 'thailand'),
('Maldives', 'https://images.unsplash.com/photo-1514282401047-d79a71a590e8', 'maldives');

-- Insert Dummy Data for Categories
INSERT INTO categories (name, image, slug) VALUES 
('Honeymoon', 'https://images.unsplash.com/photo-1515934751635-c81c6bc9a2d8', 'honeymoon'),
('Family', 'https://images.unsplash.com/photo-1511895426328-dc8714191300', 'family'),
('Adventure', 'https://images.unsplash.com/photo-1533130061792-649d45df8dd5', 'adventure'),
('Luxury', 'https://images.unsplash.com/photo-1561501900-3701fa6a0864', 'luxury');

-- Insert Dummy Data for Packages
INSERT INTO packages (title, destination_id, category_id, price, duration, image, description) VALUES 
('Romantic Bali Escape', 1, 1, 45000, '5 Days / 4 Nights', 'https://images.unsplash.com/photo-1537996194471-e657df975ab4', 'Experience the magic of Bali with your loved one.'),
('Dubai Family Fun', 2, 2, 60000, '6 Days / 5 Nights', 'https://images.unsplash.com/photo-1512453979798-5ea904ac6605', 'Enjoy the skyscrapers and deserts of Dubai.'),
('Singapore Adventure', 3, 3, 55000, '4 Days / 3 Nights', 'https://images.unsplash.com/photo-1525625293386-3f8f99389edd', 'Thrilling adventures in the Lion City.');

CREATE TABLE IF NOT EXISTS tour_requests (
    id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    full_name VARCHAR(100) NOT NULL,
    email VARCHAR(100) NOT NULL,
    phone VARCHAR(20) NOT NULL,
    city VARCHAR(100),
    destination VARCHAR(100),
    travel_date DATE,
    duration VARCHAR(50),
    budget VARCHAR(50),
    requirements TEXT,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

CREATE TABLE IF NOT EXISTS admins (
    id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    username VARCHAR(50) NOT NULL UNIQUE,
    password VARCHAR(255) NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

-- Default admin: admin / admin123
INSERT INTO admins (username, password) VALUES ('admin', '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi');
