-- CableGUI v5 — catalog: power-distribution devices.
-- Adds 5 built-in device_types (project_id NULL, built_in=1).
--
-- Multi-plug N exposes Power × (N+1) ports — one input + N outputs. The
-- solver treats every Power port identically regardless of in/out
-- direction; m knows which end is which from the physical setup.
--
-- Wifi-plug is a pass-through outlet (Power × 2: one in, one out).

INSERT INTO device_types (name, kind, icon, built_in, description) VALUES
    ('Multi-plug 3', 'hub',       '🔌', 1, '3-way power strip (1 in + 3 out)'),
    ('Multi-plug 4', 'hub',       '🔌', 1, '4-way power strip (1 in + 4 out)'),
    ('Multi-plug 5', 'hub',       '🔌', 1, '5-way power strip (1 in + 5 out)'),
    ('Multi-plug 6', 'hub',       '🔌', 1, '6-way power strip (1 in + 6 out)'),
    ('Wifi-plug',    'accessory', '📶', 1, 'WiFi-controllable pass-through outlet');

-- Port profiles. cable_types id 1 = Power (seeded in 001).

INSERT INTO device_type_ports (device_type_id, cable_type_id, label_prefix, count, edge, sort_order)
    SELECT id, 1, 'Power', 4, 'bottom', 0 FROM device_types WHERE name='Multi-plug 3' AND project_id IS NULL;

INSERT INTO device_type_ports (device_type_id, cable_type_id, label_prefix, count, edge, sort_order)
    SELECT id, 1, 'Power', 5, 'bottom', 0 FROM device_types WHERE name='Multi-plug 4' AND project_id IS NULL;

INSERT INTO device_type_ports (device_type_id, cable_type_id, label_prefix, count, edge, sort_order)
    SELECT id, 1, 'Power', 6, 'bottom', 0 FROM device_types WHERE name='Multi-plug 5' AND project_id IS NULL;

INSERT INTO device_type_ports (device_type_id, cable_type_id, label_prefix, count, edge, sort_order)
    SELECT id, 1, 'Power', 7, 'bottom', 0 FROM device_types WHERE name='Multi-plug 6' AND project_id IS NULL;

INSERT INTO device_type_ports (device_type_id, cable_type_id, label_prefix, count, edge, sort_order)
    SELECT id, 1, 'Power', 2, 'bottom', 0 FROM device_types WHERE name='Wifi-plug' AND project_id IS NULL;
