-- 迁移现有穿搭生成数据到新的多工作流系统
-- 将现有的穿搭生成功能数据迁移到新的工作流模板和执行记录表中

-- 1. 插入默认的执行环境
INSERT OR IGNORE INTO workflow_execution_environments (
    name, 
    type, 
    description, 
    base_url, 
    supported_workflow_types,
    max_concurrent_jobs,
    priority,
    is_active,
    is_available
) VALUES 
(
    '默认ComfyUI环境',
    'local_comfyui',
    '默认的ComfyUI执行环境，用于穿搭生成等AI任务',
    'https://bowongai-dev--waas-demo-fastapi-webapp.modal.run',
    '["outfit_generation", "background_replacement", "portrait_enhancement"]',
    8,
    100,
    1,
    1
);

-- 2. 插入默认的穿搭生成工作流模板
INSERT OR IGNORE INTO workflow_templates (
    name,
    base_name,
    version,
    type,
    description,
    comfyui_workflow_json,
    ui_config_json,
    execution_config_json,
    input_schema_json,
    output_schema_json,
    is_active,
    is_published,
    category,
    author
) VALUES (
    '穿搭生成 v1.0',
    'outfit_generation',
    '1.0',
    'outfit_generation',
    '基于ComfyUI的穿搭生成工作流，支持模特照片和商品图片的智能合成',
    '{}',  -- 这里需要实际的ComfyUI工作流JSON，暂时用空对象占位
    '{
        "form_fields": [
            {
                "name": "model_image",
                "type": "image_upload",
                "label": "模特照片",
                "required": true,
                "accept": "image/*"
            },
            {
                "name": "product_image", 
                "type": "image_upload",
                "label": "商品图片",
                "required": true,
                "accept": "image/*"
            },
            {
                "name": "prompt",
                "type": "textarea",
                "label": "提示词",
                "required": false,
                "placeholder": "描述想要的穿搭效果..."
            },
            {
                "name": "style",
                "type": "select",
                "label": "风格选择",
                "required": false,
                "options": ["自然", "时尚", "商务", "休闲"]
            }
        ]
    }',
    '{
        "timeout_seconds": 600,
        "retry_attempts": 3,
        "max_concurrent": 1
    }',
    '{
        "type": "object",
        "properties": {
            "model_image": {"type": "string", "format": "base64"},
            "product_image": {"type": "string", "format": "base64"},
            "prompt": {"type": "string"},
            "style": {"type": "string"}
        },
        "required": ["model_image", "product_image"]
    }',
    '{
        "type": "object",
        "properties": {
            "generated_images": {
                "type": "array",
                "items": {"type": "string", "format": "url"}
            },
            "metadata": {"type": "object"}
        }
    }',
    1,
    1,
    'AI生成',
    'MixVideo系统'
);
