
import icpList from '@/utils/ipc'
import { getRouterUrl } from '@/utils/appfun'
import client from '@/stores/modules/client'
import {useRouter} from "vue-router";
import { getWebUrlrUrl } from '@/utils/appfun'
const Router = useRouter()

const clientStore = client()
const generate =  {
        name:'高级生成',
        children:[
            {
                name:'模特图',
                click(configs){
                    console.log(configs);
                    openGaenrate('onFeetImage',configs)
                },
            },
            {
                name:'场景图',
                click(configs){
                    openGaenrate('attachScenarios',configs)
                },
            },
            {
                name:'生成视频',
                click(configs){
                    openGaenrate('video',configs)
                },
            },{
                name:'历史记录',
                click(configs){
                    openGaenrate('mine',configs)
                },
            }
        ]
    }





export function openGaenrate(type,configs) {

    const config= {
        "onFeetImage":{
            url:"/onFeetImage",
        },
        "attachScenarios":{
            url:"/attachScenarios"
        },
        "video":{
            url:"/create_video"
        },
        "mine":{
            url:"/mine"
        }
    }

    let urlParams = config[type]
    if(configs){
        urlParams = {
            ... config[type],
            ...configs
        }
    }


    clientStore.ipc.removeAllListeners(icpList.utils.openMain)
    let params = {
        title: '高级生成',
        width: 1400,
        height: 900,
        frame: true,
        id: 'generate',
        url: getWebUrlrUrl(urlParams)
    }
    clientStore.ipc.send(icpList.utils.openMain, params)
}



export default generate;
