package dto

import (
	"go-admin/app/operate/models"
	"go-admin/common/dto"
	common "go-admin/common/models"
)

type OrgMsgGetPageReq struct {
	dto.Pagination `search:"-"`
}

func (m *OrgMsgGetPageReq) GetNeedSearch() interface{} {
	return *m
}

type OrgMsgInsertReq struct {
	Id       int    `json:"-" comment:""` //
	Code     string `json:"code" comment:""`
	Username string `json:"username" comment:""`
	MsgType  string `json:"msgType" comment:""`
	common.ControlBy
}

func (s *OrgMsgInsertReq) Generate(model *models.OrgMsg) {
	if s.Id == 0 {
		model.Model = common.Model{Id: s.Id}
	}
	model.Code = s.Code
	model.Username = s.Username
	model.MsgType = s.MsgType
}

func (s *OrgMsgInsertReq) GetId() interface{} {
	return s.Id
}

type OrgMsgUpdateReq struct {
	Id       int    `uri:"id" comment:""` //
	Code     string `json:"code" comment:""`
	Username string `json:"username" comment:""`
	common.ControlBy
}

func (s *OrgMsgUpdateReq) Generate(model *models.OrgMsg) {
	if s.Id == 0 {
		model.Model = common.Model{Id: s.Id}
	}
	model.Code = s.Code
	model.Username = s.Username
}

func (s *OrgMsgUpdateReq) GetId() interface{} {
	return s.Id
}

// OrgMsgGetReq 功能获取请求参数
type OrgMsgGetReq struct {
	Username string `json:"username"`
	Code     string `json:"code"`
	MsgType  string `json:"msgType"`
}

// OrgMsgDeleteReq 功能删除请求参数
type OrgMsgDeleteReq struct {
	Username string `json:"username"`
}
