import { generateService } from "@lz-ui/openapi";

const openapiList = [
    {
        apiUrl: 'https://cos-1251140835.cos.ap-shanghai.myqcloud.com/object/2025-8-12/1066410/finyx_OpenAPI.json',
        localPath: 'finyx',
        apiPrefix: 'finyx',
    },
    {
        apiUrl: 'https://cos-1251140835.cos.ap-shanghai.myqcloud.com/object/2025-7-28/1030149/base_OpenAPI.json',
        localPath: 'base',
        apiPrefix: 'base',
    },
    {
        apiUrl: 'https://cos-1251140835.cos.ap-shanghai.myqcloud.com/object/2025-8-1/1091284/oauth_OpenAPI.json',
        localPath: 'oauth',
        apiPrefix: 'oauth',
    },


    // {
    //     // apiUrl: 'https://cos-1251140835.cos.ap-shanghai.myqcloud.com/object/2025-4-3/1012708/ai_OpenAPI.json',
    //     apiUrl: 'https://cos-1251140835.cos.ap-shanghai.myqcloud.com/object/2025-4-7/1073770/ai_OpenAPI.json',
    //     localPath: 'ai',
    //     apiPrefix: 'ai',
    // },
    // {
    //     apiUrl: 'https://cos-1251140835.cos.ap-shanghai.myqcloud.com/object/2025-3-29/1040347/oauth_OpenAPI.json',
    //     localPath: 'oauth',
    //     apiPrefix: 'oauth',
    // },
    // {
    //     apiUrl: 'https://cos-1251140835.cos.ap-shanghai.myqcloud.com/object/2025-3-18/1009894/base_OpenAPI.json',
    //     localPath: 'base/file',
    //     apiPrefix: 'base',
    // },
    // {
    //     apiUrl: 'https://cos-1251140835.cos.ap-shanghai.myqcloud.com/object/2025-3-18/1098024/base-%E5%9F%BA%E7%A1%80%E6%A8%A1%E5%9D%97_OpenAPI.json',
    //     localPath: 'base/jichu',
    //     apiPrefix: 'base',
    // }
]

async function main() {
    for (const item of openapiList) {
        const p = {
            requestLibPath: "import request from '@/request/http'", // 整合axios导出的实例位置
            schemaPath: item.apiUrl,    // 后端swagger接口文档地址
            serversPath: `./src/servers/${item.localPath}`, // 代码生成目录
            apiPrefix: `"/${item.apiPrefix}"`,
        }
        // console.log(p)
        await generateService(p);
    }
}

main()
