-- ============================================================
-- 火山引擎真人人像素材 — 模块配置 SQL
-- AK/SK 直接存储在 rl_vendor_config 表中，不再使用 uapi
-- ============================================================

-- 1. 供应商配置 (rl_vendor_config)
-- api_mapping: 内部操作名 → Volcengine API Action
-- ak/sk: 火山引擎 Access Key / Secret Key (sk加密存储)
INSERT INTO rl_vendor_config (id, vendor, vendor_title, upappid, api_mapping, status, callback_url, ak, sk, create_time, update_time) VALUES (
    'volcengine',
    'volcengine',
    '火山引擎',
    '',
    '{"create_session":"CreateVisualValidateSession","check_session":"GetVisualValidateResult","create_group":"CreateAssetGroup","upload_asset":"CreateAsset","get_asset":"GetAsset","delete_asset":"DeleteAsset","delete_group":"DeleteAssetGroup","list_groups":"ListAssetGroups","list_assets":"ListAssets","get_group":"GetAssetGroup","update_asset":"UpdateAsset","update_group":"UpdateAssetGroup"}',
    'active',
    'https://token.opencomputing.cn/reallife_asset/api/rl_callback.dspy',
    'AKLTZWE5YTY1MDRhMmIyNGFlN2JkMzBjN2U0NGFkMWQ5ODM',
    password_encode('TURFMU9ESTBNamc1TW1JMk5HVmpORGczT1dNeE0yVTRabVV4TVRJeFpUWQ=='),
    NOW(),
    NOW()
) ON DUPLICATE KEY UPDATE
    vendor_title=VALUES(vendor_title),
    api_mapping=VALUES(api_mapping),
    callback_url=VALUES(callback_url),
    ak=VALUES(ak),
    sk=VALUES(sk),
    update_time=NOW();

-- 2. 供应商下拉代码 (appcodes_kv)
-- rl_org_group 表的 vendor 字段引用此代码表
INSERT INTO appcodes_kv (parentid, k, v) VALUES
    ('rl_vendor', 'volcengine', '火山引擎')
ON DUPLICATE KEY UPDATE v=VALUES(v);
