import "../base.api"
import "./sop_stage.api"

type (
    // The response data of sop node list | SopNode列表数据
    SopNodeListResp {
        BaseDataInfo

        // SopNode list data | SopNode列表数据
        Data []*SopChildNodeInfo `json:"data"`
    }

	// The response data of sop node list | SopNode列表数据
	SopNodeListResp2 {
		BaseDataInfo

		// SopNode list data | SopNode列表数据
		Data []*SopNodeInfoWithLable `json:"data"`
	}

    // SopNode list data | SopNode列表数据
    SopChildNodeInfo {
        NodeName *string `json:"nodeName,optional"`
        ChildNode *SopChildNodeInfo `json:"childNode,optional"`

        // The API list data | SopNode列表数据
        ConditionNodes  []*SopChildNodeInfo  `json:"conditionNodes"`

        SopNodeInfo
    }

    // SopNode list data | SopNode列表数据
    SopNodeListInfo {
        BaseListInfo

        // The API list data | SopNode列表数据
        Data  []SopNodeInfo  `json:"data"`
    }

    // Get sop node list request params | SopNode列表请求参数
    SopNodeListReq {
        StageId  *uint64 `json:"stageId"`
    }

	// Get sop node list request params | SopNode列表请求参数
	BatchSopNodeListReq {
		StageIds  []uint64 `json:"stageIds"`
	}

    // SopNode information response | SopNode信息返回体
    SopNodeInfoResp {
        BaseDataInfo

        // SopNode information | SopNode数据
        Data SopNodeInfo `json:"data"`
    }

    // SopNode create response | SopNode创建返回体
    SopNodeCreateResp {
        BaseDataInfo

        // SopNode id | SopNode id
        Data uint64 `json:"data"`
    }
)

@server(
	group: sop_node
)

service Wechat {
	// Get api sop node list | 获取SopNode列表
	@handler getApiSopNodeList
	post /api/sop_node/list (BatchSopNodeListReq) returns (SopNodeListResp2)
}

@server(
    jwt: Auth
    group: sop_node
    middleware: Authority
)

service Wechat {
    // Create sop node information | 创建SopNode
    @handler createSopNode
    post /sop_node/create (SopNodeInfo) returns (SopNodeCreateResp)

    // Update sop node information | 更新SopNode
    @handler updateSopNode
    post /sop_node/update (SopNodeInfo) returns (BaseMsgResp)

    // Delete sop node information | 删除SopNode信息
    @handler deleteSopNode
    post /sop_node/delete (IDReq) returns (BaseMsgResp)

    // Get sop node list | 获取SopNode列表
    @handler getSopNodeList
    post /sop_node/list (SopNodeListReq) returns (SopNodeListResp)

    // Get sop node by ID | 通过ID获取SopNode详情
    @handler getSopNodeDetail
    post /sop_node/detail (IDReq) returns (SopNodeInfoResp)
}
