package quote

import (
	"mtp20access/model/common/response"
	"mtp20access/model/quote/request"
	"mtp20access/service/quote"

	"github.com/gin-gonic/gin"
)

func Quote(c *gin.Context) {
	if err := quote.QuoteConn(c); err != nil {
		response.FailWithMessage(err.Error(), c)
		// return
	}

	// response.OkWithMessage("连接成功", c)
}

// QuoteSubscribe 订阅商品实时行情请求
// @Summary  订阅商品实时行情请求
// @Security ApiKeyAuth
// @accept   application/json
// @Produce  application/json
// @Param    data body     request.QuoteSubscribeReq     true "入参1"
// @Success  200  {object} response.Response{msg=string} "出参"
// @Router   /Quote/QuoteSubscribe [post]
// @Tags     实时行情
func QuoteSubscribe(c *gin.Context) {
	var req request.QuoteSubscribeReq
	if err := c.ShouldBindJSON(&req); err != nil {
		response.FailWithMessage("入参不正确", c)
		return
	}

	if err := quote.QuoteSubscribe(c, req); err != nil {
		response.FailWithMessage(err.Error(), c)
		return
	}
	response.OkWithMessage("订阅成功", c)
}
