package v1

import (
	"server/internal/model"

	"github.com/gogf/gf/v2/frame/g"
)

type RuleListReq struct {
	g.Meta   `path:"/activity" tags:"Backend/Activity" method:"get" summary:"获取签到奖励规则列表"`
	Page     int    `json:"page"    dc:"页码"`
	Size     int    `json:"size"    dc:"每页数量"`
	Status   int    `json:"status"  dc:"状态"`
	RuleName string `json:"ruleName" dc:"规则名称"`
}
type RuleListRes struct {
	Total int                      `json:"total" dc:"总数"`
	List  []model.SignInRewardRule `json:"list"  dc:"规则列表"`
}

type RuleAddReq struct {
	g.Meta    `path:"/activity" tags:"Backend/Activity" method:"post" summary:"新增签到奖励规则"`
	RuleName  string `json:"ruleName"  dc:"规则名称"      v:"required"`
	CycleDays int    `json:"cycleDays" dc:"周期天数"      v:"required"`
	StartDate string `json:"startDate" dc:"开始日期"      v:"required"`
	EndDate   string `json:"endDate"   dc:"结束日期"      v:"required"`
	Status    int    `json:"status"    dc:"状态"          v:"required"`
}
type RuleAddRes struct {
	Success bool `json:"success" dc:"是否成功"`
}

type RuleEditReq struct {
	g.Meta    `path:"/activity/{id}" tags:"Backend/Activity" method:"put" summary:"编辑签到奖励规则"`
	Id        int64  `json:"id"        dc:"规则ID"      v:"required"`
	RuleName  string `json:"ruleName"  dc:"规则名称"    v:"required"`
	CycleDays int    `json:"cycleDays" dc:"周期天数"    v:"required"`
	StartDate string `json:"startDate" dc:"开始日期"    v:"required"`
	EndDate   string `json:"endDate"   dc:"结束日期"    v:"required"`
	Status    int    `json:"status"    dc:"状态"        v:"required"`
}
type RuleEditRes struct {
	Success bool `json:"success" dc:"是否成功"`
}

type RuleDelReq struct {
	g.Meta `path:"/activity/{id}" tags:"Backend/Activity" method:"delete" summary:"删除签到奖励规则"`
	Id     int64 `json:"id" dc:"规则ID" v:"required"`
}
type RuleDelRes struct {
	Success bool `json:"success" dc:"是否成功"`
}

type RuleSetStatusReq struct {
	g.Meta `path:"/activity/{id}/status" tags:"Backend/Activity" method:"patch" summary:"设置签到奖励规则状态"`
	Id     int64 `json:"id" dc:"规则ID" v:"required"`
	Status int   `json:"status" dc:"状态" v:"required"`
}
type RuleSetStatusRes struct {
	Success bool `json:"success" dc:"是否成功"`
}

// 签到奖励明细列表
type ItemListReq struct {
	g.Meta `path:"/activity/items" tags:"Backend/Activity" method:"get" summary:"获取签到奖励明细列表"`
	RuleId int64 `json:"ruleId" dc:"规则ID" v:"required"`
}
type ItemListRes struct {
	List []model.SignInRewardDetail `json:"list" dc:"明细列表"`
}

// 新增签到奖励明细
type ItemAddReq struct {
	g.Meta     `path:"/activity/item" tags:"Backend/Activity" method:"post" summary:"新增签到奖励明细"`
	RuleId     int64 `json:"ruleId"     dc:"规则ID"      v:"required"`
	DayNumber  int   `json:"dayNumber"  dc:"签到天数"    v:"required"`
	RewardType int   `json:"rewardType" dc:"奖励类型"    v:"required"`
	Quantity   int   `json:"quantity"   dc:"奖励数量"    v:"required"`
	Status     int   `json:"status"     dc:"状态"        v:"required"`
}
type ItemAddRes struct {
	Id      int64 `json:"id" dc:"明细ID"`
	Success bool  `json:"success" dc:"是否成功"`
}

// 编辑签到奖励明细
type ItemEditReq struct {
	g.Meta     `path:"/activity/item/{id}" tags:"Backend/Activity" method:"put" summary:"编辑签到奖励明细"`
	Id         int64 `json:"id"         dc:"明细ID"      v:"required"`
	RuleId     int64 `json:"ruleId"     dc:"规则ID"      v:"required"`
	DayNumber  int   `json:"dayNumber"  dc:"签到天数"    v:"required"`
	RewardType int   `json:"rewardType" dc:"奖励类型"    v:"required"`
	Quantity   int   `json:"quantity"   dc:"奖励数量"    v:"required"`
	Status     int   `json:"status"     dc:"状态"        v:"required"`
}
type ItemEditRes struct {
	Success bool `json:"success" dc:"是否成功"`
}

// 删除签到奖励明细
type ItemDelReq struct {
	g.Meta `path:"/activity/item/{id}" tags:"Backend/Activity" method:"delete" summary:"删除签到奖励明细"`
	Id     int64 `json:"id" dc:"明细ID" v:"required"`
}
type ItemDelRes struct {
	Success bool `json:"success" dc:"是否成功"`
}

// 查询单个签到奖励明细
type ItemGetReq struct {
	g.Meta `path:"/activity/item/{id}" tags:"Backend/Activity" method:"get" summary:"获取单个签到奖励明细"`
	Id     int64 `json:"id" dc:"明细ID" v:"required"`
}
type ItemGetRes struct {
	model.SignInRewardDetail
}

// 设置签到奖励明细状态
type ItemSetStatusReq struct {
	g.Meta `path:"/activity/item/{id}/status" tags:"Backend/Activity" method:"patch" summary:"设置签到奖励明细状态"`
	Id     int64 `json:"id" dc:"明细ID" v:"required"`
	Status int   `json:"status" dc:"状态" v:"required"`
}
type ItemSetStatusRes struct {
	Success bool `json:"success" dc:"是否成功"`
}

type SignInListReq struct {
	g.Meta `path:"/activity/sign" tags:"APP/Activity" method:"get" summary:"用户签到任务列表"`
}
type SignInListRes struct {
	List []model.SignInListItem `json:"list" dc:"签到列表"`
}

// 用户签到
type SignInReq struct {
	g.Meta         `path:"/activity/sign" tags:"APP/Activity" method:"post" summary:"用户签到"`
	RuleId         int64 `json:"ruleId" dc:"规则ID" v:"required"`
	RewardDetailId int64 `json:"rewardDetailId" dc:"奖励明细ID" v:"required"`
}
type SignInRes struct {
	Success bool `json:"success" dc:"是否成功"`
}
