package dto

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

type OrgSeasonGetPageReq struct {
	dto.Pagination  `search:"-"`
	LeagueId        string `form:"leagueId"  search:"type:exact;column:league_id;table:os"`
	SeasonId        string `form:"seasonId"  search:"type:exact;column:id;table:os"`
	SeasonStartTime string `form:"seasonStartTime"  search:"type:gte;column:start_time;table:os" comment:"比赛开始时间"`
	SeasonEndTime   string `form:"seasonEndTime"  search:"type:lte;column:end_time;table:os" comment:"比赛结束时间"`
	Status          string `form:"status"  search:"type:exact;column:status;table:os"`
}

type OrgSeasonGetPageReply struct {
	Id          string `json:"id"`
	LeagueId    string `json:"leagueId"`
	LeagueName  string `json:"leagueName"`
	SeasonName  string `json:"seasonName"`
	TotalRounds string `json:"totalRounds"`
	StartTime   string `json:"startTime"`
	EndTime     string `json:"endTime"`
	Status      string `json:"status"`
}

type OrgSeasonGetReply struct {
	OrgSeason     models.OrgSeason   `form:"orgSeason"`
	OrgLeagueList []models.OrgLeague `form:"orgLeagueList"`
}

type OrgSeasonOrder struct {
	Id          int       `form:"idOrder"  search:"type:order;column:id;table:org_season"`
	LeagueId    string    `form:"leagueIdOrder"  search:"type:order;column:league_id;table:org_season"`
	DivisionId  string    `form:"divisionIdOrder"  search:"type:order;column:division_id;table:org_season"`
	SeasonName  string    `form:"seasonNameOrder"  search:"type:order;column:season_name;table:org_season"`
	TotalRounds string    `form:"totalRoundsOrder"  search:"type:order;column:total_rounds;table:org_season"`
	StartTime   string    `form:"startTimeOrder"  search:"type:order;column:start_time;table:org_season"`
	EndTime     string    `form:"endTimeOrder"  search:"type:order;column:end_time;table:org_season"`
	Status      string    `form:"statusOrder"  search:"type:order;column:status;table:org_season"`
	CreateBy    string    `form:"createByOrder"  search:"type:order;column:create_by;table:org_season"`
	UpdateBy    string    `form:"updateByOrder"  search:"type:order;column:update_by;table:org_season"`
	CreatedAt   time.Time `form:"createdAtOrder"  search:"type:order;column:created_at;table:org_season"`
	UpdatedAt   time.Time `form:"updatedAtOrder"  search:"type:order;column:updated_at;table:org_season"`
	DeletedAt   time.Time `form:"deletedAtOrder"  search:"type:order;column:deleted_at;table:org_season"`
}

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

type OrgSeasonInsertReq struct {
	Id          int    `json:"-" comment:""` //
	LeagueId    string `json:"leagueId" comment:"org_league表id"`
	DivisionId  string `json:"divisionId" comment:"org_division表id"`
	SeasonName  string `json:"seasonName" comment:"赛季名称"`
	TotalRounds string `json:"totalRounds" comment:"总轮次"`
	StartTime   string `json:"startTime" comment:"赛季开始时间"`
	EndTime     string `json:"endTime" comment:"赛季结束时间"`
	Status      string `json:"status" comment:"赛季开启状态 1 是 0 否"`
	common.ControlBy
}

func (s *OrgSeasonInsertReq) Generate(model *models.OrgSeason) {
	if s.Id == 0 {
		model.Model = common.Model{Id: s.Id}
	}
	model.LeagueId = s.LeagueId
	model.DivisionId = s.DivisionId
	model.SeasonName = s.SeasonName
	model.TotalRounds = s.TotalRounds
	model.StartTime = utils.StringToTime(s.StartTime)
	model.EndTime = utils.StringToTime(s.EndTime)
	model.Status = s.Status
}

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

type OrgSeasonUpdateReq struct {
	Id          int    `uri:"id" comment:""` //
	LeagueId    string `json:"leagueId" comment:"org_league表id"`
	DivisionId  string `json:"divisionId" comment:"org_division表id"`
	SeasonName  string `json:"seasonName" comment:"赛季名称"`
	TotalRounds string `json:"totalRounds" comment:"总轮次"`
	StartTime   string `json:"startTime" comment:"赛季开始时间"`
	EndTime     string `json:"endTime" comment:"赛季结束时间"`
	Status      string `json:"status" comment:"赛季开启状态 1 是 0 否"`
	common.ControlBy
}

func (s *OrgSeasonUpdateReq) Generate(model *models.OrgSeason) {
	if s.Id == 0 {
		model.Model = common.Model{Id: s.Id}
	}
	model.LeagueId = s.LeagueId
	model.DivisionId = s.DivisionId
	model.SeasonName = s.SeasonName
	model.TotalRounds = s.TotalRounds
	model.StartTime = utils.StringToTime(s.StartTime)
	model.EndTime = utils.StringToTime(s.EndTime)
	model.Status = s.Status
}

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

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

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

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

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