syntax = "v1"

info (
	title: "websocket"// TODO: add title
	desc: // TODO: add description
	author: ""
	email: ""
)

import "basic.api"
service websocket {
	//websocket数据交互
	@handler DataTransferHandler
	get /api/websocket/data_transfer(request) returns (response);
	//渲染完了通知接口
	@handler RenderNotifyHandler
	post /api/websocket/render_notify(RenderNotifyReq) returns (response);
}

//websocket数据交互
type DataTransferData {
	T string `json:"t"` //消息类型
	D string `json:"d"` //传递的消息
}
type RenderImageReqMsg { //websocket接受需要云渲染的图片
	ProductId  int64 `json:"product_id"`
	SizeId     int64 `json:"size_id"`
	TemplateId int64 `json:"template_id"`
}
type RenderImageRspMsg { //websocket发送渲染完的数据
	ProductId  int64  `json:"product_id"`
	SizeId     int64  `json:"size_id"`
	TemplateId int64  `json:"template_id"`
	Source     string `json:"source"`
}
//渲染完了通知接口
type RenderNotifyReq {
	Sign       string       `json:"sign"`
	Time       int64        `json:"time"`
	NotifyList []NotifyItem `json:"notify_list"`
}
type NotifyItem {
	ProductId  int64  `json:"product_id"`
	SizeId     int64  `json:"size_id"`
	TemplateId int64  `json:"template_id"`
	Source     string `json:"source"`
}