-- fill_in.sql  (robust, ID-agnostic)

-- Optional: clear data if re-running
-- (Do bridges first to avoid FK issues)
DELETE FROM "User_Purchased_Package";
DELETE FROM "User_Purchased_Merch";
DELETE FROM "User_Event";
DELETE FROM "User_Booked_Class";
DELETE FROM "Class_Includes_Training";

DELETE FROM "Merch_Items";
DELETE FROM "Package";
DELETE FROM "Event";
DELETE FROM "Class";
DELETE FROM "Training";


INSERT INTO "Training" (training_name, description, duration, intensity_level)
VALUES
('Vinyasa Flow', 'Linking breath to movement', 60, 'Intermediate'),
('Hatha Basics', 'Focus on foundational poses', 45, 'Beginner');


INSERT INTO "Event" (event_name, description, date, time, location)
VALUES
('Summer Yoga Workshop', 'Outdoor event for all levels', '2025-07-05', '09:00', 'City Park'),
('Meditation Retreat',   'Weekend retreat with meditation', '2025-08-01', '08:00', 'Mountain Lodge');


INSERT INTO "Package" (package_name, price, num_classes)
VALUES
('5-Class Pass',  25.00,  5),
('10-Class Pass', 45.00, 10);


INSERT INTO "Merch_Items" (item_name, description, price, quantity_in_stock)
VALUES
('Yoga Mat',   'Eco-friendly TPE mat', 30.00, 50),
('Yoga Block', 'Cork block for alignment', 12.00, 30);

-- Class_Includes_Training (is_scheduled_for)
INSERT INTO "Class_Includes_Training" (class_id, training_id)
VALUES
(
  (SELECT class_id    FROM "Class"    WHERE date='2025-06-10' AND start_time='08:00' AND location='Studio A'),
  (SELECT training_id FROM "Training" WHERE training_name='Vinyasa Flow')
),
(
  (SELECT class_id    FROM "Class"    WHERE date='2025-06-10' AND start_time='09:30' AND location='Studio B'),
  (SELECT training_id FROM "Training" WHERE training_name='Hatha Basics')
);

-- Package_Includes_Class (is_for)
INSERT INTO "Package_Includes_Class" (package_id, class_id)
VALUES
(
  (SELECT package_id FROM "Package" WHERE package_name='5-Class Pass'),
  (SELECT class_id   FROM "Class"   WHERE date='2025-06-10' AND start_time='08:00' AND location='Studio A')
),
(
  (SELECT package_id FROM "Package" WHERE package_name='5-Class Pass'),
  (SELECT class_id   FROM "Class"   WHERE date='2025-06-10' AND start_time='09:30' AND location='Studio B')
),
(
  (SELECT package_id FROM "Package" WHERE package_name='10-Class Pass'),
  (SELECT class_id   FROM "Class"   WHERE date='2025-06-10' AND start_time='08:00' AND location='Studio A')
);
