-- Test data for eli_test.segment2
-- This creates sample fiber network segments with various configurations to test QC features
-- Actual columns: gid (auto), type, length, cost, fdh_id, geom (MultiLineString, SRID 6561), "Group 1"

-- Insert test segments with different characteristics
INSERT INTO eli_test.segment2 (type, length, cost, fdh_id, "Group 1", geom)
VALUES
-- Normal aerial segments in Zone A
('Aerial', 150.5, 1500.00, 1, 'Zone_A',
 ST_Transform(ST_GeomFromText('LINESTRING(-122.4194 37.7749, -122.4184 37.7759)', 4326), 6561)),

('Aerial', 145.2, 1450.00, 1, 'Zone_A',
 ST_Transform(ST_GeomFromText('LINESTRING(-122.4184 37.7759, -122.4174 37.7769)', 4326), 6561)),

('Aerial', 148.8, 1480.00, 1, 'Zone_A',
 ST_Transform(ST_GeomFromText('LINESTRING(-122.4174 37.7769, -122.4164 37.7779)', 4326), 6561)),

-- Underground segments in Zone A
('Underground', 142.3, 2850.00, 1, 'Zone_A',
 ST_Transform(ST_GeomFromText('LINESTRING(-122.4164 37.7779, -122.4154 37.7789)', 4326), 6561)),

('Underground', 138.7, 2775.00, 1, 'Zone_A',
 ST_Transform(ST_GeomFromText('LINESTRING(-122.4154 37.7789, -122.4144 37.7799)', 4326), 6561)),

-- More segments in Zone A
('Aerial', 155.0, 1550.00, 1, 'Zone_A',
 ST_Transform(ST_GeomFromText('LINESTRING(-122.4200 37.7800, -122.4210 37.7810)', 4326), 6561)),

('Aerial', 850.0, 8500.00, 1, 'Zone_A',
 ST_Transform(ST_GeomFromText('LINESTRING(-122.4220 37.7750, -122.4280 37.7760)', 4326), 6561)),

-- Segments in Zone B
('Aerial', 147.5, 1475.00, 2, 'Zone_B',
 ST_Transform(ST_GeomFromText('LINESTRING(-122.4094 37.7849, -122.4084 37.7859)', 4326), 6561)),

('Underground', 143.2, 2865.00, 2, 'Zone_B',
 ST_Transform(ST_GeomFromText('LINESTRING(-122.4084 37.7859, -122.4074 37.7869)', 4326), 6561)),

('Aerial', 149.9, 1499.00, 2, 'Zone_B',
 ST_Transform(ST_GeomFromText('LINESTRING(-122.4074 37.7869, -122.4064 37.7879)', 4326), 6561)),

-- Long segment for single-span testing
('Aerial', 2200.0, 22000.00, 1, 'Zone_A',
 ST_Transform(ST_GeomFromText('LINESTRING(-122.4300 37.7700, -122.4100 37.7700)', 4326), 6561)),

-- Very short segment
('Underground', 15.5, 310.00, 1, 'Zone_A',
 ST_Transform(ST_GeomFromText('LINESTRING(-122.4250 37.7820, -122.4249 37.7821)', 4326), 6561)),

-- Disconnected segment (isolated)
('Aerial', 140.0, 1400.00, 1, 'Zone_A',
 ST_Transform(ST_GeomFromText('LINESTRING(-122.5000 37.8000, -122.4990 37.8010)', 4326), 6561)),

-- Multiple segments forming a branch
('Aerial', 145.0, 1450.00, 1, 'Zone_A',
 ST_Transform(ST_GeomFromText('LINESTRING(-122.4140 37.7730, -122.4130 37.7740)', 4326), 6561)),

('Aerial', 142.0, 1420.00, 1, 'Zone_A',
 ST_Transform(ST_GeomFromText('LINESTRING(-122.4130 37.7740, -122.4120 37.7750)', 4326), 6561)),

('Aerial', 144.0, 1440.00, 1, 'Zone_A',
 ST_Transform(ST_GeomFromText('LINESTRING(-122.4130 37.7740, -122.4120 37.7730)', 4326), 6561)),

-- Segments in Zone C
('Aerial', 146.3, 1463.00, 3, 'Zone_C',
 ST_Transform(ST_GeomFromText('LINESTRING(-122.3994 37.7949, -122.3984 37.7959)', 4326), 6561)),

('Underground', 141.8, 2836.00, 3, 'Zone_C',
 ST_Transform(ST_GeomFromText('LINESTRING(-122.3984 37.7959, -122.3974 37.7969)', 4326), 6561)),

-- Additional varied segments
('Aerial', 152.0, 1520.00, 1, 'Zone_A',
 ST_Transform(ST_GeomFromText('LINESTRING(-122.4340 37.7680, -122.4330 37.7690)', 4326), 6561)),

('Underground', 139.5, 2790.00, 1, 'Zone_A',
 ST_Transform(ST_GeomFromText('LINESTRING(-122.4330 37.7690, -122.4320 37.7700)', 4326), 6561));

-- Verify insertion
SELECT COUNT(*) as total_segments FROM eli_test.segment2;
SELECT "Group 1", COUNT(*) as segment_count FROM eli_test.segment2 GROUP BY "Group 1" ORDER BY "Group 1";
