-- 装修避坑通用素材分类体系
-- 共 86 个三级分类（68 个不要X要Y + 18 个买对不买贵）

DO $$
DECLARE
    l1_id bigint;
    l2_buyao_id bigint;
    l2_maidui_id bigint;
BEGIN

    -- 一级：装修避坑通用
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-tongyong', '装修避坑通用', NULL, 1, 90, 'active', NOW(), NOW())
    RETURNING id INTO l1_id;

    -- 二级：不要X要Y
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao', '不要X要Y', l1_id, 2, 1, 'active', NOW(), NOW())
    RETURNING id INTO l2_buyao_id;

    -- 二级：买对不买贵
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-maidui', '买对不买贵', l1_id, 2, 2, 'active', NOW(), NOW())
    RETURNING id INTO l2_maidui_id;

    -- 三级：不要X要Y（68个）
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-不要一体式卫生间', '不要一体式卫生间', l2_buyao_id, 3, 1, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-不要双包套', '不要双包套', l2_buyao_id, 3, 2, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-不要双开门冰箱', '不要双开门冰箱', l2_buyao_id, 3, 3, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-不要反弹器', '不要反弹器', l2_buyao_id, 3, 4, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-不要回型吊顶', '不要回型吊顶', l2_buyao_id, 3, 5, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-不要复杂吊灯', '不要复杂吊灯', l2_buyao_id, 3, 6, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-不要复杂背景墙', '不要复杂背景墙', l2_buyao_id, 3, 7, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-不要小双槽', '不要小双槽', l2_buyao_id, 3, 8, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-不要开放式收纳柜', '不要开放式收纳柜', l2_buyao_id, 3, 9, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-不要悬浮电视柜', '不要悬浮电视柜', l2_buyao_id, 3, 10, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-不要悬空马桶', '不要悬空马桶', l2_buyao_id, 3, 11, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-不要拼色窗帘', '不要拼色窗帘', l2_buyao_id, 3, 12, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-不要推拉门', '不要推拉门', l2_buyao_id, 3, 13, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-不要插座外露', '不要插座外露', l2_buyao_id, 3, 14, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-不要无主灯', '不要无主灯', l2_buyao_id, 3, 15, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-不要普通门锁', '不要普通门锁', l2_buyao_id, 3, 16, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-不要榻榻米', '不要榻榻米', l2_buyao_id, 3, 17, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-不要正五孔插座', '不要正五孔插座', l2_buyao_id, 3, 18, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-不要洗烘一体', '不要洗烘一体', l2_buyao_id, 3, 19, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-不要深色地砖', '不要深色地砖', l2_buyao_id, 3, 20, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-不要猫眼', '不要猫眼', l2_buyao_id, 3, 21, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-不要瓷砖上墙', '不要瓷砖上墙', l2_buyao_id, 3, 22, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-不要直吸马桶', '不要直吸马桶', l2_buyao_id, 3, 23, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-不要直排下水', '不要直排下水', l2_buyao_id, 3, 24, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-不要筒灯', '不要筒灯', l2_buyao_id, 3, 25, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-不要罗马杠', '不要罗马杠', l2_buyao_id, 3, 26, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-不要贵妃椅沙发', '不要贵妃椅沙发', l2_buyao_id, 3, 27, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-不要路由器', '不要路由器', l2_buyao_id, 3, 28, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-不要过门石', '不要过门石', l2_buyao_id, 3, 29, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-不要造型柜门', '不要造型柜门', l2_buyao_id, 3, 30, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-不要阳角条', '不要阳角条', l2_buyao_id, 3, 31, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-不要隐形衣架', '不要隐形衣架', l2_buyao_id, 3, 32, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-不要集成灶', '不要集成灶', l2_buyao_id, 3, 33, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-不要高光衣柜门', '不要高光衣柜门', l2_buyao_id, 3, 34, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-要一体门', '要一体门', l2_buyao_id, 3, 35, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-要乳胶漆', '要乳胶漆', l2_buyao_id, 3, 36, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-要免拉手', '要免拉手', l2_buyao_id, 3, 37, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-要全屋wifi', '要全屋WiFi', l2_buyao_id, 3, 38, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-要全屋通铺', '要全屋通铺', l2_buyao_id, 3, 39, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-要分体灶', '要分体灶', l2_buyao_id, 3, 40, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-要十字开门冰箱', '要十字开门冰箱', l2_buyao_id, 3, 41, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-要单包套', '要单包套', l2_buyao_id, 3, 42, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-要双眼皮', '要双眼皮', l2_buyao_id, 3, 43, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-要双眼皮吊顶', '要双眼皮吊顶', l2_buyao_id, 3, 44, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-要吸顶灯', '要吸顶灯', l2_buyao_id, 3, 45, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-要墙排下水', '要墙排下水', l2_buyao_id, 3, 46, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-要大单槽', '要大单槽', l2_buyao_id, 3, 47, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-要封闭式收纳柜', '要封闭式收纳柜', l2_buyao_id, 3, 48, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-要射灯', '要射灯', l2_buyao_id, 3, 49, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-要干湿分离卫生间', '要干湿分离卫生间', l2_buyao_id, 3, 50, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-要平板柜门', '要平板柜门', l2_buyao_id, 3, 51, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-要打通阳台', '要打通阳台', l2_buyao_id, 3, 52, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-要斜五孔插座', '要斜五孔插座', l2_buyao_id, 3, 53, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-要普通床', '要普通床', l2_buyao_id, 3, 54, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-要普通衣架', '要普通衣架', l2_buyao_id, 3, 55, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-要智能门锁', '要智能门锁', l2_buyao_id, 3, 56, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-要洗烘套装', '要洗烘套装', l2_buyao_id, 3, 57, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-要浅色地砖', '要浅色地砖', l2_buyao_id, 3, 58, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-要海棠角', '要海棠角', l2_buyao_id, 3, 59, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-要直排沙发', '要直排沙发', l2_buyao_id, 3, 60, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-要窗帘盒', '要窗帘盒', l2_buyao_id, 3, 61, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-要简约背景墙', '要简约背景墙', l2_buyao_id, 3, 62, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-要纯色窗帘', '要纯色窗帘', l2_buyao_id, 3, 63, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-要肤感衣柜门', '要肤感衣柜门', l2_buyao_id, 3, 64, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-要落地电视柜', '要落地电视柜', l2_buyao_id, 3, 65, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-要落地马桶', '要落地马桶', l2_buyao_id, 3, 66, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-要虹吸马桶', '要虹吸马桶', l2_buyao_id, 3, 67, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-buyao-要隐藏式插座', '要隐藏式插座', l2_buyao_id, 3, 68, 'active', NOW(), NOW());

    -- 三级：买对不买贵（18个）
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-maidui-乳胶漆不要买贵的', '乳胶漆不要买贵的', l2_maidui_id, 3, 1, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-maidui-全屋角阀要买贵的', '全屋角阀要买贵的', l2_maidui_id, 3, 2, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-maidui-前置过滤器不要买贵的', '前置过滤器不要买贵的', l2_maidui_id, 3, 3, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-maidui-床不要买贵的', '床不要买贵的', l2_maidui_id, 3, 4, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-maidui-床垫要买贵的', '床垫要买贵的', l2_maidui_id, 3, 5, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-maidui-开关插座要买贵的', '开关插座要买贵的', l2_maidui_id, 3, 6, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-maidui-投影仪要买贵的', '投影仪要买贵的', l2_maidui_id, 3, 7, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-maidui-木地板要买贵的', '木地板要买贵的', l2_maidui_id, 3, 8, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-maidui-木门不要买贵的', '木门不要买贵的', l2_maidui_id, 3, 9, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-maidui-水槽不要买贵的', '水槽不要买贵的', l2_maidui_id, 3, 10, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-maidui-水龙头要买贵的', '水龙头要买贵的', l2_maidui_id, 3, 11, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-maidui-滑轨要买贵的', '滑轨要买贵的', l2_maidui_id, 3, 12, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-maidui-灯具不要买贵的', '灯具不要买贵的', l2_maidui_id, 3, 13, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-maidui-瓷砖不要买贵的', '瓷砖不要买贵的', l2_maidui_id, 3, 14, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-maidui-电视机不要买贵的', '电视机不要买贵的', l2_maidui_id, 3, 15, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-maidui-窗帘不要买贵的', '窗帘不要买贵的', l2_maidui_id, 3, 16, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-maidui-腻子粉要买贵的', '腻子粉要买贵的', l2_maidui_id, 3, 17, 'active', NOW(), NOW());
    INSERT INTO mjk_broll_categories (slug, name, parent_id, level, sort_order, status, created_at, updated_at)
    VALUES ('bikeng-maidui-门锁要买贵的', '门锁要买贵的', l2_maidui_id, 3, 18, 'active', NOW(), NOW());

END $$;
