-- Dev seed: German household with Italian-leaning staples
-- Fixed UUIDs so the migration is idempotent and references are stable.

-- ─── User & Household ────────────────────────────────────────────────────────

INSERT INTO user_account (id, email, password_hash, display_name, created_at)
VALUES (
    'aaaaaaaa-0000-0000-0000-000000000001',
    'dev@mealprep.local',
    -- bcrypt of "dev" — never expose this outside local dev
    '$2a$10$IK233Yyc62EHt2hL5fw9F.0fBlEdoERr75LldZD35VFAAYfnkaOuK',
    'Dev User',
    now()
)
ON CONFLICT (id) DO NOTHING;

INSERT INTO household (id, name, created_by, created_at)
VALUES (
    'bbbbbbbb-0000-0000-0000-000000000001',
    'Musterhaushalt',
    'aaaaaaaa-0000-0000-0000-000000000001',
    now()
)
ON CONFLICT (id) DO NOTHING;

INSERT INTO household_member (household_id, user_id, role, joined_at)
VALUES (
    'bbbbbbbb-0000-0000-0000-000000000001',
    'aaaaaaaa-0000-0000-0000-000000000001',
    'planner',
    now()
)
ON CONFLICT (user_id) DO NOTHING;

-- ─── Ingredient Categories ───────────────────────────────────────────────────

INSERT INTO ingredient_category (id, household_id, name, sort_order) VALUES
    ('cc000001-0000-0000-0000-000000000001', 'bbbbbbbb-0000-0000-0000-000000000001', 'Gemüse',                  1),
    ('cc000001-0000-0000-0000-000000000002', 'bbbbbbbb-0000-0000-0000-000000000001', 'Obst',                     2),
    ('cc000001-0000-0000-0000-000000000003', 'bbbbbbbb-0000-0000-0000-000000000001', 'Fleisch & Fisch',          3),
    ('cc000001-0000-0000-0000-000000000004', 'bbbbbbbb-0000-0000-0000-000000000001', 'Milchprodukte & Eier',     4),
    ('cc000001-0000-0000-0000-000000000005', 'bbbbbbbb-0000-0000-0000-000000000001', 'Getreide & Nudeln',        5),
    ('cc000001-0000-0000-0000-000000000006', 'bbbbbbbb-0000-0000-0000-000000000001', 'Hülsenfrüchte',            6),
    ('cc000001-0000-0000-0000-000000000007', 'bbbbbbbb-0000-0000-0000-000000000001', 'Konserven',                7),
    ('cc000001-0000-0000-0000-000000000008', 'bbbbbbbb-0000-0000-0000-000000000001', 'Gewürze & Kräuter',        8),
    ('cc000001-0000-0000-0000-000000000009', 'bbbbbbbb-0000-0000-0000-000000000001', 'Öle & Essig',              9),
    ('cc000001-0000-0000-0000-000000000010', 'bbbbbbbb-0000-0000-0000-000000000001', 'Saucen & Pasten',         10),
    ('cc000001-0000-0000-0000-000000000011', 'bbbbbbbb-0000-0000-0000-000000000001', 'Nüsse & Samen',           11),
    ('cc000001-0000-0000-0000-000000000012', 'bbbbbbbb-0000-0000-0000-000000000001', 'Backzutaten',             12),
    ('cc000001-0000-0000-0000-000000000013', 'bbbbbbbb-0000-0000-0000-000000000001', 'Tiefkühl',                13),
    ('cc000001-0000-0000-0000-000000000014', 'bbbbbbbb-0000-0000-0000-000000000001', 'Getränke',                14)
ON CONFLICT (household_id, name) DO NOTHING;

-- ─── Staple Ingredients ──────────────────────────────────────────────────────
-- is_staple = true means "always keep in stock"

-- Gemüse (frisch → kein Staple)
INSERT INTO ingredient (id, household_id, name, is_staple, category_id) VALUES
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Zwiebeln',           true,  'cc000001-0000-0000-0000-000000000001'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Knoblauch',          true,  'cc000001-0000-0000-0000-000000000001'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Karotten',           false, 'cc000001-0000-0000-0000-000000000001'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Staudensellerie',    false, 'cc000001-0000-0000-0000-000000000001'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Tomaten',            false, 'cc000001-0000-0000-0000-000000000001'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Paprika',            false, 'cc000001-0000-0000-0000-000000000001'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Zucchini',           false, 'cc000001-0000-0000-0000-000000000001'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Aubergine',          false, 'cc000001-0000-0000-0000-000000000001'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Spinat',             false, 'cc000001-0000-0000-0000-000000000001'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Brokkoli',           false, 'cc000001-0000-0000-0000-000000000001'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Kartoffeln',         false, 'cc000001-0000-0000-0000-000000000001'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Süßkartoffeln',      false, 'cc000001-0000-0000-0000-000000000001'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Lauch',              false, 'cc000001-0000-0000-0000-000000000001')
ON CONFLICT DO NOTHING;

-- Obst (frisch → kein Staple)
INSERT INTO ingredient (id, household_id, name, is_staple, category_id) VALUES
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Zitronen',           false, 'cc000001-0000-0000-0000-000000000002'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Limetten',           false, 'cc000001-0000-0000-0000-000000000002')
ON CONFLICT DO NOTHING;

-- Fleisch & Fisch (frisches Fleisch → kein Staple; Konserven/Gepökeltes → Staple)
INSERT INTO ingredient (id, household_id, name, is_staple, category_id) VALUES
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Hähnchenbrust',          false, 'cc000001-0000-0000-0000-000000000003'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Hackfleisch (gemischt)', false, 'cc000001-0000-0000-0000-000000000003'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Pancetta',               true,  'cc000001-0000-0000-0000-000000000003'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Thunfisch (Dose)',        true,  'cc000001-0000-0000-0000-000000000003')
ON CONFLICT DO NOTHING;

-- Milchprodukte & Eier (frisch → kein Staple)
INSERT INTO ingredient (id, household_id, name, is_staple, category_id) VALUES
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Eier',               false, 'cc000001-0000-0000-0000-000000000004'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Butter',             false, 'cc000001-0000-0000-0000-000000000004'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Parmesan',           false, 'cc000001-0000-0000-0000-000000000004'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Mozzarella',         false, 'cc000001-0000-0000-0000-000000000004'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Sahne',              false, 'cc000001-0000-0000-0000-000000000004'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Schmand',            false, 'cc000001-0000-0000-0000-000000000004'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Ricotta',            false, 'cc000001-0000-0000-0000-000000000004'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Milch',              false, 'cc000001-0000-0000-0000-000000000004')
ON CONFLICT DO NOTHING;

-- Getreide & Nudeln (Pasta → kein Staple; Trockenvorräte wie Reis/Mehl → Staple)
INSERT INTO ingredient (id, household_id, name, is_staple, category_id) VALUES
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Spaghetti',             false, 'cc000001-0000-0000-0000-000000000005'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Penne',                 false, 'cc000001-0000-0000-0000-000000000005'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Tagliatelle',            false, 'cc000001-0000-0000-0000-000000000005'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Lasagneplatten',         false, 'cc000001-0000-0000-0000-000000000005'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Risottoreis (Arborio)',  true,  'cc000001-0000-0000-0000-000000000005'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Basmati-Reis',           true,  'cc000001-0000-0000-0000-000000000005'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Weizenmehl (Type 405)',  true,  'cc000001-0000-0000-0000-000000000005'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Paniermehl',             true,  'cc000001-0000-0000-0000-000000000005'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Polenta',                true,  'cc000001-0000-0000-0000-000000000005'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Haferflocken',           true,  'cc000001-0000-0000-0000-000000000005')
ON CONFLICT DO NOTHING;

-- Hülsenfrüchte
INSERT INTO ingredient (id, household_id, name, is_staple, category_id) VALUES
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Kichererbsen (Dose)', true, 'cc000001-0000-0000-0000-000000000006'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Rote Linsen',        true, 'cc000001-0000-0000-0000-000000000006'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Cannellini-Bohnen (Dose)', true, 'cc000001-0000-0000-0000-000000000006')
ON CONFLICT DO NOTHING;

-- Konserven
INSERT INTO ingredient (id, household_id, name, is_staple, category_id) VALUES
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Gehackte Tomaten (Dose)', true, 'cc000001-0000-0000-0000-000000000007'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'San-Marzano-Tomaten (Dose)', true, 'cc000001-0000-0000-0000-000000000007'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Tomatenmark',        true, 'cc000001-0000-0000-0000-000000000007'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Gemüsebrühe',        true, 'cc000001-0000-0000-0000-000000000007'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Hühnerbrühe',        true, 'cc000001-0000-0000-0000-000000000007'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Kapern',             true, 'cc000001-0000-0000-0000-000000000007'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Oliven (schwarz)',   true, 'cc000001-0000-0000-0000-000000000007'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Sardellen (Dose)',   true, 'cc000001-0000-0000-0000-000000000007')
ON CONFLICT DO NOTHING;

-- Gewürze & Kräuter
INSERT INTO ingredient (id, household_id, name, is_staple, category_id) VALUES
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Salz',               true, 'cc000001-0000-0000-0000-000000000008'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Schwarzer Pfeffer',  true, 'cc000001-0000-0000-0000-000000000008'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Oregano (getrocknet)', true, 'cc000001-0000-0000-0000-000000000008'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Basilikum (getrocknet)', true, 'cc000001-0000-0000-0000-000000000008'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Thymian (getrocknet)', true, 'cc000001-0000-0000-0000-000000000008'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Rosmarin (getrocknet)', true, 'cc000001-0000-0000-0000-000000000008'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Lorbeerblätter',     true, 'cc000001-0000-0000-0000-000000000008'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Paprikapulver (edelsüß)', true, 'cc000001-0000-0000-0000-000000000008'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Chiliflocken',       true, 'cc000001-0000-0000-0000-000000000008'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Muskat (gemahlen)',  true, 'cc000001-0000-0000-0000-000000000008'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Zimt (gemahlen)',    true, 'cc000001-0000-0000-0000-000000000008'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Kümmel (gemahlen)',  true, 'cc000001-0000-0000-0000-000000000008'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Zucker',             true, 'cc000001-0000-0000-0000-000000000008'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Knoblauchpulver',    true, 'cc000001-0000-0000-0000-000000000008')
ON CONFLICT DO NOTHING;

-- Öle & Essig
INSERT INTO ingredient (id, household_id, name, is_staple, category_id) VALUES
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Olivenöl (extra vergine)', true, 'cc000001-0000-0000-0000-000000000009'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Rapsöl',             true, 'cc000001-0000-0000-0000-000000000009'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Balsamico-Essig',    true, 'cc000001-0000-0000-0000-000000000009'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Weißweinessig',      true, 'cc000001-0000-0000-0000-000000000009')
ON CONFLICT DO NOTHING;

-- Saucen & Pasten
INSERT INTO ingredient (id, household_id, name, is_staple, category_id) VALUES
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Basilikum-Pesto',    true, 'cc000001-0000-0000-0000-000000000010'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Tomatenpassata',     true, 'cc000001-0000-0000-0000-000000000010'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Sojasauce',          true, 'cc000001-0000-0000-0000-000000000010'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Worcestershiresauce', true, 'cc000001-0000-0000-0000-000000000010'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Senf (mittelscharf)', true, 'cc000001-0000-0000-0000-000000000010')
ON CONFLICT DO NOTHING;

-- Nüsse & Samen
INSERT INTO ingredient (id, household_id, name, is_staple, category_id) VALUES
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Pinienkerne',        true, 'cc000001-0000-0000-0000-000000000011'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Walnüsse',           true, 'cc000001-0000-0000-0000-000000000011'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Sonnenblumenkerne',  true, 'cc000001-0000-0000-0000-000000000011'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Rosinen',            true, 'cc000001-0000-0000-0000-000000000011')
ON CONFLICT DO NOTHING;

-- Backzutaten
INSERT INTO ingredient (id, household_id, name, is_staple, category_id) VALUES
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Backpulver',         true, 'cc000001-0000-0000-0000-000000000012'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Trockenhefe',        true, 'cc000001-0000-0000-0000-000000000012'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Natron',             true, 'cc000001-0000-0000-0000-000000000012'),
    (gen_random_uuid(), 'bbbbbbbb-0000-0000-0000-000000000001', 'Vanilleextrakt',     true, 'cc000001-0000-0000-0000-000000000012')
ON CONFLICT DO NOTHING;
