from enum import StrEnum

class FoundationBlockName(StrEnum):
    """基础块名称枚举"""
    # 检查任务实例ID是否存在处理器
    CHECK_TASK_RECORD_ID_IS_EXIST = "CheckTaskRecordIdIsExistBp"
    # 释放资源处理器
    RELEASE_RESOURCE = "ReleaseResourceBp"
    # 创建UUID处理器
    CREATE_UUID = "CreateUuidBp"
    # 打印处理器
    PRINT = "PrintBp"
    # 当前时间戳处理器
    CURRENT_TIME_STAMP = "CurrentTimeStampBp"
    # JDBC执行处理器
    JDBC_EXECUTE = "JdbcExecuteBp"
    # JDBC查询处理器
    JDBC_QUERY = "JdbcQueryBp"
    # 当前时间处理器
    TIMESTAMP = "TimestampBp"
    # 字符串转JSON对象处理器
    STRING_TO_JSON_OBJECT = "StringToJsonObjectBp"
    # 字符串转JSON数组处理器
    STRING_TO_JSON_ARRAY = "StringToJsonArrayBp"
    # FoundationBlockNameDict = {}

class HttpRequestBlockName(StrEnum):
    """HTTP请求块名称枚举"""
    GET = "GetBp" # GET请求
    POST = "PostBp" # POST请求

class ModbusBlockName(StrEnum):
    """Modbus块名称枚举"""
    COMMON_READ_NAME = "ModbusCommonReadNameBp" # 通用读取Modbus值(Name)
    COMMON_WRITE_NAME = "ModbusCommonWriteNameBp" # 通用写入Modbus值(Name)
    COMMON_WAIT_NAME = "ModbusCommonWaitNameBp" # 通用等待Modbus值(Name)

class ProgressBlockName(StrEnum):
    """进度块名称枚举"""
    IF = "IfBp" # 条件判断块
    WHILE = "WhileBp" # 循环块
    WAIT = "WaitBp" # 等待块
    IF_ELSE = "IfElseBp" # 条件判断块(else)
    ITERATE_LIST = "IterateListBp" # 迭代列表块
    DELAY = "DelayBp" # 延迟块
    BREAK = "BreakBp" # 中断块
    RETURN = "ReturnBp" # 返回块
    SERIAL_FLOW = "SerialFlowBp" # 串行流程块
    PARALLEL_FLOW = "ParallelFlowBp" # 并行流程块
    REPEAT_NUM = "RepeatNumBp" # 重复次数块
    THROW_EXCEPTION = "ThrowExceptionBp" # 抛出异常块

class RobotBlockName(StrEnum):
    """机器人块名称枚举"""
    AGV_OPERATION = "CAgvOperationBp" # 机器人通用动作
    VEHICLE_STATION = "VehicleStationBp" # 获取机器人位置
    GET_BATTERY_LEVEL = "GetBatteryLevelBp" # 获取机器人电量
    GET_PGV_CODE = "GetPGVCodeBp" # 获取机器人PGV码
    SELECT_AGV = "CSelectAgvBp" # 选择执行机器人

class ScriptBlockName(StrEnum):
    """脚本块名称枚举"""
    SET_TASK_VARIABLES = "ScriptVariablesBp" # 设置任务变量
    SCRIPT = "ScriptBp" # 脚本

class StorageBlockName(StrEnum):
    """存储块名称枚举"""
    BATCH_SETTING_SITE = "BatchSettingSiteBp" # 批量设置库位
    GET_IDLE_CROWDED_SITE = "GetIdleCrowdedSiteBp" # 获取空闲拥挤库位
    GET_IDLE_SITE = "GetIdleSiteBp" # 获取空闲库位
    GET_LOCKED_SITES_BY_TASK_RECORD_ID = "GetLockedSitesByTaskRecordIdBp" # 获取任务记录锁定库位
    GET_SITE_ATTR = "GetSiteAttrBp" # 获取库位扩展属性
    QUERY_IDLE_SITE = "QueryIdleSiteBp" # 查询库位
    SET_SITE_ATTR = "SetSiteAttrBp" # 设置库位扩展属性
    SET_SITE_CONTENT = "SetSiteContentBp" # 设置库位货物处理器
    SET_SITE_EMPTY = "SetSiteEmptyBp" # 设置库位空闲
    SET_SITE_FILLED = "SetSiteFilledBp" # 设置库位填充
    SET_SITE_LOCKED = "SetSiteLockedBp" # 设置库位锁定
    SET_SITE_TAGS = "SetSiteTagsBp" # 设置库位标签
    SET_SITE_UNLOCKED = "SetSiteUnlockedBp" # 设置库位解锁

class SubTaskBlockName(StrEnum):
    """子任务块名称枚举"""
    SUB_TASK = "SubTaskBp" # 子任务

class TaskBlockName(StrEnum):
    """任务块名称枚举"""
    CACHE_DATA = "CacheDataBp" # 缓存数据
    CLEAR_CACHE_DATA = "ClearCacheDataBp" # 清除缓存数据
    GET_CACHE_DATA = "GetCacheDataBp" # 获取缓存数据
    SET_TASK_VARIABLE = "SetTaskVariableBp" # 设置任务变量
    SKIP_TO_COMPONENT = "SkipToComponent" # 跳到某个块
    TASK_STATE = "TaskStateBp" # 任务状态


BLOCK_NAME_STR = {
    # 基础块
    FoundationBlockName.CHECK_TASK_RECORD_ID_IS_EXIST: "检查任务实例ID是否存在块",
    FoundationBlockName.RELEASE_RESOURCE: "释放资源块",
    FoundationBlockName.CREATE_UUID: "创建UUID块",
    FoundationBlockName.PRINT: "打印块",
    FoundationBlockName.CURRENT_TIME_STAMP: "当前时间戳块",
    FoundationBlockName.JDBC_EXECUTE: "JDBC执行块",
    FoundationBlockName.JDBC_QUERY: "JDBC查询块",
    FoundationBlockName.TIMESTAMP: "当前时间块",
    FoundationBlockName.STRING_TO_JSON_OBJECT: "字符串转JSON对象块",
    FoundationBlockName.STRING_TO_JSON_ARRAY: "字符串转JSON数组块",
    
    # HTTP请求块
    HttpRequestBlockName.GET: "GET请求块",
    HttpRequestBlockName.POST: "POST请求块",
    
    # Modbus块
    ModbusBlockName.COMMON_READ_NAME: "通用读取Modbus值块",
    ModbusBlockName.COMMON_WRITE_NAME: "通用写入Modbus值块",
    ModbusBlockName.COMMON_WAIT_NAME: "通用等待Modbus值块",
    
    # 进度块
    ProgressBlockName.IF: "条件判断块",
    ProgressBlockName.WHILE: "循环块",
    ProgressBlockName.WAIT: "等待块",
    ProgressBlockName.IF_ELSE: "条件判断块(else)",
    ProgressBlockName.ITERATE_LIST: "迭代列表块",
    ProgressBlockName.DELAY: "延迟块",
    ProgressBlockName.BREAK: "中断块",
    ProgressBlockName.RETURN: "返回块",
    ProgressBlockName.SERIAL_FLOW: "串行流程块",
    ProgressBlockName.PARALLEL_FLOW: "并行流程块",
    ProgressBlockName.REPEAT_NUM: "重复次数块",
    ProgressBlockName.THROW_EXCEPTION: "抛出异常块",
    
    # 机器人块
    RobotBlockName.AGV_OPERATION: "机器人通用动作块",
    RobotBlockName.VEHICLE_STATION: "获取机器人位置块",
    RobotBlockName.GET_BATTERY_LEVEL: "获取机器人电量块",
    RobotBlockName.GET_PGV_CODE: "获取机器人PGV码块",
    RobotBlockName.SELECT_AGV: "选择执行机器人块",
    
    # 脚本块
    ScriptBlockName.SET_TASK_VARIABLES: "设置任务变量块",
    ScriptBlockName.SCRIPT: "执行脚本块",
    
    # 存储块
    StorageBlockName.BATCH_SETTING_SITE: "批量设置库位块",
    StorageBlockName.GET_IDLE_CROWDED_SITE: "获取密集库区块",
    StorageBlockName.GET_IDLE_SITE: "获取库位块",
    StorageBlockName.GET_LOCKED_SITES_BY_TASK_RECORD_ID: "获取任务记录锁定库位块",
    StorageBlockName.GET_SITE_ATTR: "获取库位扩展属性块",
    StorageBlockName.QUERY_IDLE_SITE: "查询库位块",
    StorageBlockName.SET_SITE_ATTR: "设置库位扩展属性块",
    StorageBlockName.SET_SITE_CONTENT: "设置库位占用块",
    StorageBlockName.SET_SITE_EMPTY: "设置库位为空块",
    StorageBlockName.SET_SITE_FILLED: "设置库位为占用块",
    StorageBlockName.SET_SITE_LOCKED: "设置库位锁定块",
    StorageBlockName.SET_SITE_TAGS: "设置库位标签块",
    StorageBlockName.SET_SITE_UNLOCKED: "解锁库位块",
    
    # 子任务块
    SubTaskBlockName.SUB_TASK: "子任务块",
    
    # 任务块
    TaskBlockName.CACHE_DATA: "缓存数据块",
    TaskBlockName.CLEAR_CACHE_DATA: "清除缓存数据块",
    TaskBlockName.GET_CACHE_DATA: "获取缓存数据块",
    TaskBlockName.SET_TASK_VARIABLE: "设置任务变量块",
    TaskBlockName.SKIP_TO_COMPONENT: "跳转到某个块",
    TaskBlockName.TASK_STATE: "任务状态块",
    "RootBp":"根节点"
}





