#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
系统内部服务API配置
用于配置与系统内部服务通信的相关参数
"""

import os
from typing import Dict, Any, Optional, List

# 天系统内部服务API端点配置
tf_api_endpoints = {
    "create_task": "/task",
    "choose_amr": "/taskBlock",
    "add_action": "/taskBlockAction",
    "closure_task": "/taskBlock/{}/closure",
    "get_task_block": "/taskBlock/{id}",
    "get_task_block_action": "/taskBlockAction/{id}",
    "set_task_in_progress": "/task/vwedtask/{id}/inprogress",
    "set_task_completed": "/task/vwedtask/{id}/completed",
    "set_task_terminated": "/task/vwedtask/{id}/terminated",
    "set_task_failed": "/task/vwedtask/{id}/failed"
}

# 系统内部服务API HTTP方法配置
tf_api_methods = {
    "create_task": "POST",
    "choose_amr": "POST",
    "add_action": "POST",
    "closure_task": "PUT",
    "get_task_block": "GET",
    "get_task_block_action": "GET",
    "set_task_in_progress": "PUT",
    "set_task_completed": "PUT",
    "set_task_terminated": "PUT",
    "set_task_failed": "PUT"
}

# 从环境变量读取配置，或使用默认值
# TF_API_BASE_URL = os.getenv("TF_API_BASE_URL", "http://192.168.189.80:8080/jeecg-boot")
TF_API_BASE_URL = os.getenv("TF_API_BASE_URL", "http://111.231.146.230:4080/jeecg-boot")
TF_API_TIMEOUT = int(os.getenv("TF_API_TIMEOUT", "60"))
TF_API_RETRY_TIMES = int(os.getenv("TF_API_RETRY_TIMES", "3"))
TF_API_MOCK_MODE = False
TF_API_TOKEN_HEADER = os.getenv("TF_API_TOKEN_HEADER", "X-Access-Token") # token请求头名称
TF_API_TOKEN = os.getenv("TF_API_TOKEN", "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE3NDk3NzY1MzEsInVzZXJuYW1lIjoiYWRtaW4ifQ.uRLHZuRQTrR2fHyA-dMzP46yXAa5wdjfdUcmr9PNY4g")

def get_tf_api_config() -> Dict[str, Any]:
    """获取天风系统API配置"""
    return {
        "base_url": TF_API_BASE_URL,
        "timeout": TF_API_TIMEOUT,
        "retry_times": TF_API_RETRY_TIMES,
        "mock_mode": TF_API_MOCK_MODE,
        "endpoints": tf_api_endpoints,
        "methods": tf_api_methods,
        "token_header": TF_API_TOKEN_HEADER
    } 