package qixing

import (
	"github.com/go-playground/validator/v10"
)

type QiXingRequestBo struct {
	Content    string `json:"content" validate:"required"`
	Timestamp  int64  `json:"timestamp" validate:"required"`
	Ciphertext string `json:"ciphertext" validate:"required"`
}

// QiXingResponse 响应结构体 {"msg":"SUCCESS"} / {"msg":"操作成功"}
type QiXingResponse struct {
	Msg string `json:"msg"`
}

func (c *QiXingRequestBo) Validate() error {

	if err := validator.New().Struct(c); err != nil {
		for _, err = range err.(validator.ValidationErrors) {
			return err
		}
	}

	return nil
}
