-- Insert a sample restaurant
INSERT INTO restaurants (name, address, phone, description)
VALUES (
    'The Cozy Bistro',
    '123 Main Street, Anytown',
    '555-123-4567',
    'A charming bistro with delicious food and a cozy atmosphere.'
  );

-- Get the ID of the newly inserted restaurant
SELECT id INTO @restaurant_id FROM restaurants WHERE name = 'The Cozy Bistro';

-- Insert tables for the restaurant
INSERT INTO tables (restaurant_id, table_number, capacity, is_available)
VALUES
    (@restaurant_id, 'T1', 4, TRUE),
    (@restaurant_id, 'T2', 2, TRUE),
    (@restaurant_id, 'T3', 6, TRUE),
    (@restaurant_id, 'T4', 4, FALSE),
    (@restaurant_id, 'T5', 2, TRUE);

-- Insert some sample reservations (optional, for testing)
INSERT INTO reservations (restaurant_id, table_id, reservation_time, guest_name, guest_phone, guest_count)
VALUES
    (@restaurant_id, (SELECT id FROM tables WHERE table_number = 'T1' AND restaurant_id = @restaurant_id), NOW() + INTERVAL '1 day', 'John Doe', '555-987-6543', 2),
    (@restaurant_id, (SELECT id FROM tables WHERE table_number = 'T4' AND restaurant_id = @restaurant_id), NOW() + INTERVAL '2 days', 'Jane Smith', '555-111-2222', 4);
