package dto

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

type OrgDivisionGetPageReq struct {
	dto.Pagination `search:"-"`
	DivisionName   string `form:"divisionName"  search:"type:contains;column:division_name;table:org_division" comment:"赛区名称"` //赛区名称
}

type OrgDivisionOrder struct {
	Id           int       `form:"idOrder"  search:"type:order;column:id;table:org_division"`
	DivisionName string    `form:"divisionNameOrder"  search:"type:order;column:division_name;table:org_division"`
	Status       string    `form:"statusOrder"  search:"type:order;column:status;table:org_division"`
	CreateBy     string    `form:"createByOrder"  search:"type:order;column:create_by;table:org_division"`
	UpdateBy     string    `form:"updateByOrder"  search:"type:order;column:update_by;table:org_division"`
	CreatedAt    time.Time `form:"createdAtOrder"  search:"type:order;column:created_at;table:org_division"`
	UpdatedAt    time.Time `form:"updatedAtOrder"  search:"type:order;column:updated_at;table:org_division"`
	DeletedAt    time.Time `form:"deletedAtOrder"  search:"type:order;column:deleted_at;table:org_division"`
}

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

type OrgDivisionInsertReq struct {
	Id           int    `json:"-" comment:""` //
	DivisionName string `json:"divisionName" comment:"赛区名称"`
	Status       string `json:"status" comment:"赛区开启状态 1 是 0否"`
	common.ControlBy
}

func (s *OrgDivisionInsertReq) Generate(model *models.OrgDivision) {
	if s.Id == 0 {
		model.Model = common.Model{Id: s.Id}
	}
	model.DivisionName = s.DivisionName
	model.Status = s.Status
}

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

type OrgDivisionUpdateReq struct {
	Id           int    `uri:"id" comment:""` //
	DivisionName string `json:"divisionName" comment:"赛区名称"`
	Status       string `json:"status" comment:"赛区开启状态 1 是 0否"`
	common.ControlBy
}

func (s *OrgDivisionUpdateReq) Generate(model *models.OrgDivision) {
	if s.Id == 0 {
		model.Model = common.Model{Id: s.Id}
	}
	model.DivisionName = s.DivisionName
	model.Status = s.Status
}

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

// OrgDivisionGetReq 功能获取请求参数
type OrgDivisionGetReq struct {
	Id int `uri:"id"`
}

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

// OrgDivisionDeleteReq 功能删除请求参数
type OrgDivisionDeleteReq struct {
	Ids []int `json:"ids"`
}

func (s *OrgDivisionDeleteReq) GetId() interface{} {
	return s.Ids
}
