package github

import (
	"github.com/tidbcloud/devops/api"
	gitent "github.com/tidbcloud/devops/entity/github"
)

type CursorPagerReq struct {
	PerPage int    `form:"per_page"`
	Cursor  string `form:"cursor"`
}

type CursorPagerResp struct {
	EndCursor   string `json:"end_cursor"`
	HasNextPage bool   `json:"has_next_page"`
}

type RawListReleasesReq struct {
	CursorPagerReq
}

type RawListReleasesResp struct {
	api.BaseResp `json:",inline"`

	Page     CursorPagerResp  `json:"page"`
	Releases []gitent.Release `json:"releases"`
}

type RawGetReleaseResp struct {
	api.BaseResp `json:",inline"`

	Release gitent.Release `json:"release"`
}

type RawDiffReleaseReq struct {
	Target string `form:"target" binding:"required"`
	Prev   string `form:"prev" binding:"required"`
}

type RawDiffReleaseResp struct {
	api.BaseResp `json:",inline"`

	PRs []gitent.PullRequest `json:"pull_requests"`
}

type RawListLabelsReq struct {
	CursorPagerReq
}

type RawListLabelsResp struct {
	api.BaseResp `json:",inline"`

	Page   CursorPagerResp `json:"page"`
	Labels []gitent.Label  `json:"labels"`
}

type RawGetLabelResp struct {
	api.BaseResp `json:",inline"`

	Label gitent.Label `json:"label"`
}

type RawListPullRequestsReq struct {
	CursorPagerReq

	Labels []string `form:"labels"`
}

type RawListPullRequestsResp struct {
	api.BaseResp `json:",inline"`

	Page CursorPagerResp      `json:"page"`
	PRs  []gitent.PullRequest `json:"pull_requests"`
}

type RawGetPullRequestResp struct {
	api.BaseResp `json:",inline"`

	PR gitent.PullRequest `json:"pull_request"`
}
