-- Script to populate beach_bed_types table with all 77 items from beachbedtypes.txt
-- This replaces the sample data and uses real beach element types

-- Clear existing beach bed types (removing sample data)
TRUNCATE TABLE beach_bed_types RESTART IDENTITY CASCADE;

-- Insert all 77 beach bed types from beachbedtypes.txt
INSERT INTO beach_bed_types (bed_type_id, name, description, photo_path, uid, is_layout, has_background_color) VALUES
(1, 'Single Bed', 'A standard single bed suitable for one person, no complimentary drink', './assets/images/singlev2_reg.svg', 40, false, false),
(2, 'Twin Beds', 'Two single beds with a parasol suitable for two people', './assets/images/twinv2_reg.svg', 67, false, false),
(3, 'Large Square', 'Large Square', './assets/images/large_squarev2_reg.svg', 71, false, false),
(4, 'Large Round', 'Our most luxurious bed suitable for 8-10 people.', './assets/images/large_roundv2_reg.svg', 24, false, false),
(5, 'Individual Sun Lounger', 'A standard single bed suitable for one person, no complimentary drink.', './assets/images/single_reg.svg', 39, false, false),
(6, 'Beach/Opium beds', 'BOTTOM LINES, max 3 pax, no complimentary drink', './assets/images/twin_reg.svg', 66, false, false),
(7, 'Large Round Bed', 'Large Round Bed, max 2 per, no complimentary drink', './assets/images/large_round_reg.svg', 72, false, false),
(8, 'VIP BEACH BED with SOFA', 'TOP LINES, max 6 pax, includes 0.75L Taittinger', './assets/images/large_square_reg.svg', 25, false, false),
(9, 'Booth', 'Booth', './assets/images/booth_01.svg', 2, false, false),
(10, 'Booth', 'Booth', './assets/images/booth_02.svg', 3, false, false),
(11, 'Booth', 'Booth', './assets/images/booth_03.svg', 4, false, false),
(12, 'Booth', 'Booth', './assets/images/booth_04.svg', 5, false, false),
(13, 'Sofa', 'Sofa', './assets/images/sofa_01.svg', 41, false, false),
(14, 'Sofa', 'Sofa', './assets/images/sofa_02.svg', 42, false, false),
(15, 'Sofa', 'Sofa', './assets/images/sofa_03.svg', 43, false, false),
(16, 'Sofa', 'Sofa', './assets/images/sofa_04.svg', 44, false, false),
(17, 'Sofa', 'Sofa', './assets/images/sofa_05.svg', 45, false, false),
(18, 'Single Bed', 'A standard single bed suitable for one person, no complimentary drink', './assets/images/singlev2_reg.svg', 40, false, false),
(19, 'Pool', 'Pool', './assets/images/circle_pool.svg', 16, true, false),
(20, 'Pool', 'Pool', './assets/images/square_pool.svg', 47, true, false),
(21, 'Pool', 'Pool', './assets/images/circle_pool_dark.svg', 15, true, false),
(22, 'Pool', 'Pool', './assets/images/square_pool_dark.svg', 46, true, false),
(23, 'Circle', 'Circle', './assets/images/circle.svg', 17, true, false),
(24, 'Square', 'Square', './assets/images/square.svg', 48, true, false),
(25, 'Square Table', 'Square Table', './assets/images/squaretable3.svg', 50, true, false),
(26, 'Square Table', 'Square Table', './assets/images/squaretable2.svg', 49, true, false),
(27, 'Round Table', 'Round Table', './assets/images/table_round.svg', 57, true, false),
(28, 'Small Table', 'Small Table', './assets/images/table_small.svg', 58, true, false),
(29, 'Table Set', 'Table Set', './assets/images/tableset.svg', 59, true, false),
(30, 'Large Table', 'Large Table', './assets/images/table_large.svg', 56, true, false),
(31, 'Booth Table', 'Booth Table', './assets/images/boothtable1.svg', 6, true, false),
(32, 'Booth Table', 'Booth Table', './assets/images/boothtable1.svg', 7, true, false),
(33, 'Round Table', 'Round Table', './assets/images/roundtable2.svg', 32, true, false),
(34, 'Round Table', 'Round Table', './assets/images/roundtable3.svg', 33, true, false),
(35, 'Tree', 'Tree', './assets/images/tree.svg', 63, true, false),
(36, 'Tree', 'Tree', './assets/images/tree2.svg', 64, true, false),
(37, 'Tree', 'Tree', './assets/images/tree3.svg', 65, true, false),
(38, 'Bush', 'Bush', './assets/images/bush1.svg', 9, true, false),
(39, 'Bush', 'Bush', './assets/images/bush2.svg', 10, true, false),
(40, 'Bush', 'Bush', './assets/images/bush3.svg', 11, true, false),
(41, 'Palmtree', 'Palmtree', './assets/images/palmtree1.svg', 27, true, false),
(42, 'Palmtree', 'Palmtree', './assets/images/palmtree2.svg', 28, true, false),
(43, 'Chair', 'Chair', './assets/images/chair1.svg', 12, true, false),
(44, 'Chair', 'Chair', './assets/images/chair2.svg', 13, true, false),
(45, 'Chair', 'Chair', './assets/images/chair3.svg', 14, true, false),
(46, 'Bar', 'Bar', './assets/images/bar.svg', 1, true, false),
(47, 'Arrows', 'Arrows', './assets/images/both.svg', 8, true, false),
(48, 'Diving board', 'Diving board', './assets/images/divingboard.svg', 18, true, false),
(49, 'DJ', 'DJ', './assets/images/dj.svg', 19, true, false),
(50, 'Entrance', 'Entrance', './assets/images/entrance.svg', 21, true, false),
(51, 'Exit', 'Exit', './assets/images/exit.svg', 22, true, false),
(52, 'Ladder', 'Ladder', './assets/images/ladder.svg', 23, true, false),
(53, 'Lifering', 'Lifering', './assets/images/lifering.svg', 26, true, false),
(54, 'Reception', 'Reception', './assets/images/reception.svg', 29, true, false),
(55, 'Restaurant', 'Restaurant', './assets/images/restaurant.svg', 30, true, false),
(56, 'Ring', 'Ring', './assets/images/ring.svg', 31, true, false),
(57, 'Sea', 'Sea', './assets/images/sea1.svg', 34, true, false),
(58, 'Sea', 'Sea', './assets/images/sea2.svg', 35, true, false),
(59, 'Shower', 'Shower', './assets/images/shower.svg', 36, true, false),
(60, 'Shower', 'Shower', './assets/images/shower2.svg', 37, true, false),
(61, 'Shower', 'Shower', './assets/images/shower3.svg', 38, true, false),
(62, 'Steps', 'Steps', './assets/images/steps1.svg', 51, true, false),
(63, 'Steps', 'Steps', './assets/images/steps2.svg', 52, true, false),
(64, 'Round Table', 'Round Table', './assets/images/stool1.svg', 53, true, false),
(65, 'Round Table', 'Round Table', './assets/images/stool2.svg', 54, true, false),
(66, 'Round Table', 'Round Table', './assets/images/stool3.svg', 55, true, false),
(67, 'Toilets', 'Toilets', './assets/images/toilets.svg', 60, true, false),
(68, 'Toilets', 'Toilets', './assets/images/toilets2.svg', 61, true, false),
(69, 'Toilets', 'Toilets', './assets/images/toilets3.svg', 62, true, false),
(70, 'Umbrella', 'Umbrella', './assets/images/Umbrella5.svg', 68, true, false),
(71, 'Umbrella', 'Umbrella', './assets/images/Umbrella6.svg', 69, true, false),
(72, 'Umbrella', 'Umbrella', './assets/images/Umbrella7.svg', 70, true, false),
(73, 'Special Shape', 'Special Shape', './assets/images/specialshape.svg', 73, true, true),
(74, 'Special Shape', 'Special Shape', './assets/images/specialshape (1).svg', 74, true, true),
(75, 'Line Shape', 'Line Shape', './assets/images/line_shape (1).svg', 75, true, false);

-- Add any missing UIDs that exist in the Vue app but not in the txt file
-- These are referenced in the JavaScript code but missing from beachbedtypes.txt

-- Create indexes for better performance
CREATE INDEX IF NOT EXISTS idx_beach_bed_types_uid ON beach_bed_types(uid);
CREATE INDEX IF NOT EXISTS idx_beach_bed_types_is_layout ON beach_bed_types(is_layout);

-- Add comment to table
COMMENT ON TABLE beach_bed_types IS 'Beach bed types and layout elements with icon paths and properties';

-- Update the sequence to ensure proper auto-increment
SELECT setval('beach_bed_types_bed_type_id_seq', (SELECT MAX(bed_type_id) FROM beach_bed_types));

-- Verification query - show inserted data summary
SELECT 
    COUNT(*) as total_items,
    COUNT(CASE WHEN is_layout = false THEN 1 END) as bed_items,
    COUNT(CASE WHEN is_layout = true THEN 1 END) as layout_items,
    COUNT(CASE WHEN has_background_color = true THEN 1 END) as items_with_bg_color
FROM beach_bed_types;

COMMIT;