package v1

import (
	"server/internal/model"

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

type ListReq struct {
	g.Meta  `path:"/author" tags:"Backend/Author" method:"get" summary:"获取作者列表"`
	Page    int    `json:"page"    dc:"页码"`
	Size    int    `json:"size"    dc:"每页数量"`
	PenName string `json:"penName" dc:"笔名（模糊搜索）"`
	Status  int    `json:"status"  dc:"状态：1正常，2禁用"`
}
type ListRes struct {
	Total int         `json:"total" dc:"总数"`
	List  interface{} `json:"list"  dc:"作者列表"`
}

type AddReq struct {
	g.Meta  `path:"/author" tags:"Backend/Author" method:"post" summary:"新增作者"`
	UserId  int64  `json:"userId"  dc:"用户ID"   v:"required"`
	PenName string `json:"penName" dc:"笔名"     v:"required"`
	Bio     string `json:"bio"     dc:"作者简介"`
	Status  int    `json:"status"  dc:"状态：1正常，2禁用"`
}
type AddRes struct {
	Success bool `json:"success" dc:"是否成功"`
}

type EditReq struct {
	g.Meta  `path:"/author" tags:"Backend/Author" method:"put" summary:"编辑作者"`
	Id      int64  `json:"id"      dc:"作者ID"   v:"required"`
	PenName string `json:"penName" dc:"笔名"     v:"required"`
	Bio     string `json:"bio"     dc:"作者简介"`
	Status  int    `json:"status"  dc:"状态：1正常，2禁用"`
}
type EditRes struct {
	Success bool `json:"success" dc:"是否成功"`
}

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

// 关注作者
// =============================
type FollowReq struct {
	g.Meta   `path:"/author/follow" tags:"APP/Author" method:"post" summary:"关注作者"`
	AuthorId int64 `json:"authorId" dc:"作者ID" v:"required"`
}
type FollowRes struct {
	Success bool `json:"success" dc:"是否成功"`
}

// 取消关注作者
// =============================
type UnfollowReq struct {
	g.Meta   `path:"/author/unfollow" tags:"APP/Author" method:"post" summary:"取消关注作者"`
	AuthorId int64 `json:"authorId" dc:"作者ID" v:"required"`
}
type UnfollowRes struct {
	Success bool `json:"success" dc:"是否成功"`
}
type DetailReq struct {
	g.Meta   `path:"/author/detail" tags:"APP/Author" method:"get" summary:"作者详情"`
	AuthorId int64 `json:"authorId" dc:"作者ID" v:"required"`
}
type DetailRes struct {
	*model.AuthorDetailOut
}

type AuthorInfoReq struct {
	g.Meta `path:"/author/info" tags:"Backend/Author" method:"get" summary:"作者基础信息"`
}
type AuthorInfoRes struct {
	Id      int64  `json:"id"`
	PenName string `json:"penName"`
	Role    string `json:"role"`
}

type ApplyReq struct {
	g.Meta  `path:"/author/apply" tags:"APP/Author" method:"post" summary:"申请作者"`
	Bio     string `json:"bio"     dc:"作者简介"`
	PenName string `json:"penName" dc:"笔名"`
}

type ApplyRes struct {
	g.Meta  `path:"/author/apply" tags:"APP/Author" method:"post" summary:"申请作者"`
	Success bool   `json:"success" dc:"是否成功"`
	Msg     string `json:"msg"     dc:"消息"`
}

// 审核作者
// =============================
type ReviewReq struct {
	g.Meta   `path:"/author/review" tags:"Backend/Author" method:"post" summary:"审核作者申请"`
	AuthorId int64 `json:"authorId" dc:"作者ID" v:"required"`
	Status   int   `json:"status"  dc:"审核状态：1通过，3拒绝" v:"required|in:1,3"`
}
type ReviewRes struct {
	Success bool `json:"success" dc:"是否成功"`
}
