package httpreply

import (
	"net/http"

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

const (
	Code_OK  = 200
	Code_Err = -1
)

type ReplyData struct {
	Status  int    `json:"status"`  // 状态码 200代表成功
	Message string `json:"message"` // 消息
	Data    any    `json:"data"`    // 实体数据
}

func NewDefaultReplyData() *ReplyData { return &ReplyData{Status: 200, Message: "", Data: nil} }
func NewReplyData(status int, message string, data any) *ReplyData {
	return &ReplyData{Status: status, Message: message, Data: data}
}

func Reply(c *gin.Context, data *ReplyData) {
	c.JSON(http.StatusOK, data)
}
