package bus

import (
	"infish.cn/comm"
)

type TreeAddDefMatgroupReq struct {
	DbName string
	UserId string
	Name   string
}

type TreeRemoveDefMatgroupReq struct {
	DbId     string
	DefineId string
}

type TreeAddDefineResp struct {
	Host       string
	DbId       string
	DefineId   string
	Collection string
}

// 对queentree数据操作
func TreeAddDefineMeshpack(DbName, UserId, Name string) (resp *TreeAddDefineResp, err error) {
	req := &TreeAddDefMatgroupReq{DbName: DbName, UserId: UserId, Name: Name}
	out := &TreeAddDefineResp{}
	// 调用queentree包中的接口
	err = NatsCenter.RequestPackApi("tree.define.add.meshpack", req, out, &comm.RequestOptions{
		DeployPack: "queentree",
	})
	return out, err
}

func TreeRemoveDefineMeshpack(DbId, defineId string) error {
	req := &TreeRemoveDefMatgroupReq{DbId: DbId, DefineId: defineId}
	return NatsCenter.RequestPackApi("tree.define.remove.meshpack", req, nil, &comm.RequestOptions{
		DeployPack: "queentree",
	})
}
