package v1

import (
	"server/internal/model"

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

type ListReq struct {
	g.Meta `path:"/recommend" tags:"Backend/Recommend" method:"get" summary:"获取推荐列表"`
	Page   int   `json:"page"   dc:"页码"`
	Size   int   `json:"size"   dc:"每页数量"`
	Type   int   `json:"type"   dc:"推荐类型"`
	Status int   `json:"status" dc:"状态"`
	BookId int64 `json:"bookId" dc:"书籍ID"`
}
type ListRes struct {
	Total int                        `json:"total" dc:"总数"`
	List  []model.BookRecommendation `json:"list"  dc:"推荐列表"`
}

type AddReq struct {
	g.Meta    `path:"/recommend" tags:"Backend/Recommend" method:"post" summary:"新增推荐"`
	BookId    int64  `json:"bookId"    dc:"书籍ID"      v:"required"`
	Type      int    `json:"type"      dc:"推荐类型"    v:"required"`
	CoverUrl  string `json:"coverUrl"  dc:"封面图"      v:"required"`
	SortOrder int    `json:"sortOrder" dc:"排序"        v:"required"`
	Status    int    `json:"status"    dc:"状态"        v:"required"`
}
type AddRes struct {
	Success bool `json:"success" dc:"是否成功"`
}

type EditReq struct {
	g.Meta    `path:"/recommend" tags:"Backend/Recommend" method:"put" summary:"编辑推荐"`
	Id        int64  `json:"id"        dc:"推荐ID"      v:"required"`
	BookId    int64  `json:"bookId"    dc:"书籍ID"      v:"required"`
	Type      int    `json:"type"      dc:"推荐类型"    v:"required"`
	CoverUrl  string `json:"coverUrl"  dc:"封面图"      v:"required"`
	SortOrder int    `json:"sortOrder" dc:"排序"        v:"required"`
	Status    int    `json:"status"    dc:"状态"        v:"required"`
}
type EditRes struct {
	Success bool `json:"success" dc:"是否成功"`
}

type DelReq struct {
	g.Meta `path:"/recommend" tags:"Backend/Recommend" method:"delete" summary:"删除推荐"`
	Id     int64 `json:"id" dc:"推荐ID" v:"required"`
}
type DelRes struct {
	Success bool `json:"success" dc:"是否成功"`
}

type SetStatusReq struct {
	g.Meta `path:"/recommend/set-status" tags:"Backend/Recommend" method:"post" summary:"设置推荐状态"`
	Id     int64 `json:"id" dc:"推荐ID" v:"required"`
	Status int   `json:"status" dc:"状态" v:"required"`
}
type SetStatusRes struct {
	Success bool `json:"success" dc:"是否成功"`
}

type SortOrderReq struct {
	g.Meta    `path:"/recommend/sort-order" tags:"Backend/Recommend" method:"post" summary:"设置推荐排序"`
	Id        int64 `json:"id" dc:"推荐ID" v:"required"`
	SortOrder int   `json:"sortOrder" dc:"排序" v:"required"`
}
type SortOrderRes struct {
	Success bool `json:"success" dc:"是否成功"`
}

type AppListReq struct {
	g.Meta `path:"/recommend/app/list" tags:"APP/Recommend" method:"get" summary:"App获取推荐列表"`
	Type   int `json:"type"   dc:"推荐类型"`
	Status int `json:"status" dc:"状态"`
	Page   int `json:"page"   dc:"页码"`
	Size   int `json:"size"   dc:"每页数量"`
}

type AppListRes struct {
	Total int                      `json:"total" dc:"总数"`
	List  []model.RecommendAppItem `json:"list"  dc:"推荐列表"`
}

type UploadCoverReq struct {
	g.Meta `path:"/recommend/upload-cover" tags:"Backend/Recommend" method:"post" summary:"上传推荐封面图"`
	File   *ghttp.UploadFile `json:"file" type:"file" dc:"图片文件"`
}
type UploadCoverRes struct {
	Url string `json:"url" dc:"图片访问地址"`
}
