USE zlatnosi_aplikacija;

INSERT INTO categories (name, slug, description, image_url, is_active)
VALUES
('Podne pločice', 'podne-plocice', 'Pločice za podne površine.', 'https://picsum.photos/seed/cat-floor/600/400', 1),
('Zidne pločice', 'zidne-plocice', 'Pločice za zidove kupatila, kuhinje i hodnika.', 'https://picsum.photos/seed/cat-wall/600/400', 1),
('Tuš kabine', 'tus-kabine', 'Savremene tuš kabine različitih dimenzija.', 'https://picsum.photos/seed/cat-shower/600/400', 1),
('Slavine', 'slavine', 'Baterije i slavine za kupatilo i kuhinju.', 'https://picsum.photos/seed/cat-faucet/600/400', 1),
('Ormarići', 'ormarici', 'Kupatilski i pomoćni ormarići.', 'https://picsum.photos/seed/cat-cabinet/600/400', 1)
ON DUPLICATE KEY UPDATE name = VALUES(name);

INSERT INTO products (name, code, price, description, image_url, package_info, dimensions, area_per_package, product_url, category)
VALUES
('Podna pločica Terra Sand', 'PP-601', 34.90, 'Mat podna pločica visoke otpornosti.', 'https://picsum.photos/seed/floor1/600/400', 'Pakovanje: 1.44 m2', '60x60 cm', 1.44, 'https://example.com/proizvod/pp-601', 'podne pločice'),
('Podna pločica Urban Graphite', 'PP-744', 39.00, 'R10 podna pločica za kupatilo i kuhinju.', 'https://picsum.photos/seed/floor2/600/400', 'Pakovanje: 1.20 m2', '60x120 cm', 1.20, 'https://example.com/proizvod/pp-744', 'podne pločice'),
('Zidna pločica Ivory Gloss', 'ZP-310', 27.50, 'Sjajna zidna pločica svetlog tona.', 'https://picsum.photos/seed/wall1/600/400', 'Pakovanje: 1.62 m2', '30x60 cm', 1.62, 'https://example.com/proizvod/zp-310', 'zidne pločice'),
('Zidna pločica Concrete White', 'ZP-415', 30.20, 'Neutralna tekstura za savremene zidove.', 'https://picsum.photos/seed/wall2/600/400', 'Pakovanje: 1.44 m2', '60x60 cm', 1.44, 'https://example.com/proizvod/zp-415', 'zidne pločice'),
('Tuš kabina Crystal 90', 'TK-090', 289.00, 'Kaljeno staklo 8 mm sa soft-close sistemom.', 'https://picsum.photos/seed/shower1/600/400', 'Set', '90x90 cm', NULL, 'https://example.com/proizvod/tk-090', 'tuš kabine'),
('Slavina Flow Black', 'SL-221', 88.00, 'Jednoručna slavina u mat crnoj boji.', 'https://picsum.photos/seed/faucet1/600/400', 'Komad', 'Standard', NULL, 'https://example.com/proizvod/sl-221', 'slavine'),
('Slavina Flow Chrome', 'SL-197', 79.90, 'Hromirana varijanta sa aeratorom.', 'https://picsum.photos/seed/faucet2/600/400', 'Komad', 'Standard', NULL, 'https://example.com/proizvod/sl-197', 'slavine'),
('Ormarić Nova 80', 'OR-800', 245.00, 'Viseći ormarić sa mekanim zatvaranjem.', 'https://picsum.photos/seed/cabinet1/600/400', 'Komad', '80x45 cm', NULL, 'https://example.com/proizvod/or-800', 'ormarići')
ON DUPLICATE KEY UPDATE
name = VALUES(name),
price = VALUES(price),
description = VALUES(description),
image_url = VALUES(image_url),
package_info = VALUES(package_info),
dimensions = VALUES(dimensions),
area_per_package = VALUES(area_per_package),
product_url = VALUES(product_url),
category = VALUES(category);

UPDATE products p
LEFT JOIN categories c ON LOWER(c.name) = LOWER(p.category)
SET p.category_id = c.id
WHERE p.category_id IS NULL;

INSERT INTO users (username, password_hash, role, is_active)
VALUES
('admin', '$2y$12$.bT2L9UUhxh4FmxR.qCE3eWf/zgKxpChKilRiwDg4ufvNrPn/vg66', 'admin', 1),
('korisnik', '$2y$12$snb3.NqRw1o8BeZIJQGOxuhMrvsZ66RbYnxAWe.1T5jSL6q7rthyK', 'user', 1)
ON DUPLICATE KEY UPDATE
password_hash = VALUES(password_hash),
role = VALUES(role),
is_active = VALUES(is_active);

INSERT INTO app_settings (setting_key, setting_value)
VALUES
('wings_cache_dir', ''),
('wp_base_url', ''),
('wp_consumer_key', ''),
('wp_consumer_secret', '')
ON DUPLICATE KEY UPDATE
setting_value = VALUES(setting_value);

INSERT INTO room_options (name, slug, image_url, is_active, sort_order)
VALUES
('Kupatilo', 'kupatilo', 'https://images.unsplash.com/photo-1620626011761-996317b8d101?auto=format&fit=crop&w=1200&q=80', 1, 1),
('Hodnik', 'hodnik', 'https://images.unsplash.com/photo-1484154218962-a197022b5858?auto=format&fit=crop&w=1200&q=80', 1, 2),
('Kuhinja', 'kuhinja', 'https://images.unsplash.com/photo-1556911220-e15b29be8c8f?auto=format&fit=crop&w=1200&q=80', 1, 3)
ON DUPLICATE KEY UPDATE
name = VALUES(name),
image_url = VALUES(image_url),
is_active = VALUES(is_active),
sort_order = VALUES(sort_order);
