package trade

import (
	"Wine-Server/utils"
	"Wine-Server/utils/tables"
	"github.com/gorilla/websocket"
)

func Handle(msg utils.WsMsg, conn *websocket.Conn, manager *tables.ManagerTable) {
	switch msg.Event {
	case "adminTradeQueryUser":
		queryUser(conn, msg.Data)
		break
	case "adminTradeQueryTrade":
		queryTrade(conn, msg.Data)
		break
	case "adminTradeRefund":
		refund(conn, manager, msg.Data)
		break
	default:
		_ = conn.WriteJSON(utils.WsError("unrecognized event"))
		break
	}
}
