import { Dispatch, SetStateAction, createContext } from 'react'
import { InferResultRes, ItaskDetail, IuserInfosParams, IpowerDetail } from '@/pages/api/base/type'

interface contextProps {
    inferResult: [
        inferResult: InferResultRes[] | null,
        setInferResult: (e: InferResultRes[] | null) => void,
    ]
    inferStarList: [
        inferStartList: InferResultRes[],
        setInferStarList: Dispatch<SetStateAction<InferResultRes[]>>,
    ]
    newInferResult: [
        inferResult: InferResultRes[] | null,
        setNewInferResult: (e: InferResultRes[] | null) => void,
    ]
    taskResult: [taskResult: ItaskDetail, setTaskResult: (e: ItaskDetail) => void]
    agentName: [agentName: string | null, setAgentName: (e: string | null) => void]
    pageRefreshState: [pageRefreshState: number]
    refreshPageList: () => void
    taskId: [taskId: string | null, setTaskId: (e: string | null) => void]
    segementModal: [segementModal: boolean | null, setSegmentModal: (e: boolean | null) => void]
    taskDetail: (value?: string) => void
    handleTaskResult: (key: string, value: any, tigger?: boolean) => void
    saveTaskDetail: (value?: object) => void
    samMask: (value: string) => void
    requestLoading: [requestLoading: boolean, setRequestLoading: (e: boolean) => void]
    showEdit: [showEdit: boolean, setShowEdit: (e: boolean) => void]
    userInfos: [
        userInfos: IuserInfosParams | null,
        setUserInfos: (e: IuserInfosParams | null) => void,
    ]
    powerBalanceAmount: [powerBalanceAmount: number, setPowerBalance: (e: number) => void]
    needPower: [needPower: number, setNeedPower: (e: number) => void]
    startTaskExecutions: [startTaskExecutions: boolean, setStartExecutions: (e: boolean) => void]
    mainCutMask: [mainCutMask: string, setMainCutMask: (e: string) => void]
    batchTaskPowerDetail: [
        batchTaskPowerDetail: IpowerDetail,
        setBatchTaskPowerDetail: (e: IpowerDetail) => void,
    ]
}

const AppContext = createContext<contextProps | null>(null)

export default AppContext
