-- =====================================================================================
-- 为测试用户生成地址数据
-- 用户: test@mall.com
-- User ID: b653fded-7d5e-4950-aa0d-725595543e3c
-- =====================================================================================

DO $$
DECLARE
    v_user_id UUID := 'b653fded-7d5e-4950-aa0d-725595543e3c';
BEGIN
    -- 1. 插入家庭地址 (默认地址)
    INSERT INTO public.ml_user_addresses (
        user_id,
        receiver_name,
        receiver_phone,
        province,
        city,
        district,
        address_detail,
        postal_code,
        is_default,
        label,
        status,
        created_at,
        updated_at
    ) VALUES (
        v_user_id,
        '测试用户',
        '13800138000',
        '北京市',
        '北京市',
        '朝阳区',
        '三里屯街道太古里北区 1 号楼 101 室',
        '100027',
        TRUE,
        '家',
        1,
        NOW(),
        NOW()
    );

    -- 2. 插入公司地址
    INSERT INTO public.ml_user_addresses (
        user_id,
        receiver_name,
        receiver_phone,
        province,
        city,
        district,
        address_detail,
        postal_code,
        is_default,
        label,
        status,
        created_at,
        updated_at
    ) VALUES (
        v_user_id,
        '测试员',
        '13900139000',
        '上海市',
        '上海市',
        '浦东新区',
        '陆家嘴环路 1000 号金茂大厦 88 层',
        '200120',
        FALSE,
        '公司',
        1,
        NOW(),
        NOW()
    );

    -- 3. 插入其他地址
    INSERT INTO public.ml_user_addresses (
        user_id,
        receiver_name,
        receiver_phone,
        province,
        city,
        district,
        address_detail,
        postal_code,
        is_default,
        label,
        status,
        created_at,
        updated_at
    ) VALUES (
        v_user_id,
        '张三',
        '13700137000',
        '广东省',
        '深圳市',
        '南山区',
        '粤海街道科技园南区虚拟大学园',
        '518057',
        FALSE,
        '学校',
        1,
        NOW(),
        NOW()
    );

    RAISE NOTICE '地址数据生成完成 user_id: %', v_user_id;
END $$;
