'''
Author: deng.yinping deng.yinping@muchinfo.cn
Date: 2024-12-06 15:02:12
LastEditors: deng.yinping deng.yinping@muchinfo.cn
LastEditTime: 2025-03-26 14:06:45
FilePath: \MTP20_i18n_Tool\main.py
Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
'''

from src.tools import Tools
from src.service_tools import Service_Tools
from src.scrip_toos import Scrip_Tools

output_folder_pc="output"
json_folder_pc="C:/Workspaces/Code_Git/MTP20_WEB_GLOBAL/public/locales/"
oem_json_folder_pc = "C:/Workspaces/Code_Git/MTP20_WEB_GLOBAL/oem/"

output_folder_manage="output_manage"
json_folder_manage="C:/Workspaces/Code_Git/MTP2.0_NEWMANAGE_WEB\public/locales/"
oem_json_folder_manage = "C:/Workspaces/Code_Git/MTP2.0_NEWMANAGE_WEB/oem/"

output_folder_manage_service="output_manage_service"
json_folder_manage_service="C:/Workspaces/Code_Git/MTP2.0_NEWMANAGE_SERVICE/mtp3-century/src/main/resources/"
oem_json_folder_manage_service = ""

output_folder_script="output_script"

if __name__ == "__main__":
    while True:    
        platform = input("请选择平台 (pc, manage, service, script, exit): ")
        
        if platform == "exit":
            break
        
        if platform == "pc":
            type = input("请选择生成类型 (excel, json): ")
            oem = "tss"
            inc_file = "20250326_tss_inc"
            print("inc_file:" + inc_file)
            if type == "excel":
                # 生成交易前端excel及增量
                Tools.generate_excel(oem, inc_file, output_folder_pc, json_folder_pc, oem_json_folder_pc)
            elif type == "json":
                # 生成交易前端json及增量
                Tools.generate_json_files(oem, output_folder_pc, json_folder_pc, oem_json_folder_pc)
        elif platform == "manage":
            type = input("请选择生成类型 (excel, json): ")
            oem = "newmanage"
            inc_file = "20250326_newmanage_inc"
            print("inc_file:" + inc_file)
            if type == "excel":
               # 生成新管理端前端excel及增量
               Tools.generate_excel(oem, inc_file, output_folder_manage, json_folder_manage, oem_json_folder_manage)
            elif type == "json":
                # 生成新管理端前端json
                Tools.generate_json_files(oem, output_folder_manage, json_folder_manage, oem_json_folder_manage)
        elif platform == "service":
            type = input("请选择生成类型 (excel, resource): ")
            # 新管理端后台多语言
            oem = "newmanage_service"
            inc_file = "20250306_newmanage_service_inc"
            print("inc_file:" + inc_file)
            if type == "excel":
               # 生成新管理端服务excel及增量
               Service_Tools.generate_excel(oem, inc_file, output_folder_manage_service, json_folder_manage_service, oem_json_folder_manage_service)
            elif type == "resource":
                # 生成新管理端服务properties
                Service_Tools.generate_properties_files(oem, output_folder_manage_service, json_folder_manage_service, oem_json_folder_manage_service)
        elif platform == "script":
            type = input("请选择生成类型 (enum, error): ")
            # 新管理端后台多语言
            if type == "enum":
               # 根据excel生成09.dict_init_ex.sql脚本文件
               Scrip_Tools.generate_enumex_sql(output_folder_script)
            elif type == "error":
                # 根据excel生成15.errorcode_ex.sql脚本文件
                Scrip_Tools.generate_errorcodeex_sql(output_folder_script)
        else:
            print("输入错误，请重新输入...")
        
        print("==============================")

     
   