package approval

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

type GetApprovalResp struct {
	api.BaseResp

	Approval        *apprent.Approval `json:"approval"`
	CanApprove      bool              `json:"can_approve"`
	CanAdminApprove bool              `json:"can_admin_approve"`
}

type CreateApprovalReq struct {
	// Name is the approval's name used to categorize the approval.
	Name string `json:"name"`
	// Applicant is the user who applies for the approval.
	Applicant string `json:"applicant"`
	// DetailLink is a link showed in the notifcation.
	DetailLink string `json:"detail_link"`
	// Parameters is the parameters showed in the notifcation.
	Parameters map[string]string `json:"parameters"`
	// Overview is a human-readable summary shown in approval notifications.
	Overview map[string]string `json:"overview,omitempty"`
	// Reason is the reason of the approval.
	Reason string
	// Configuration is the approval configuration.
	Configuration apprent.ApprovalConfiguration `json:"configuration"`
	// Nodes is the approval nodes.
	//
	// If it is empty, the approval will be approved after created.
	Nodes   []*apprent.ApproverNode `json:"nodes"`
	CCTasks *apprent.Approver       `json:"cc_tasks"`
}

type CreateApprovalResp struct {
	api.BaseResp

	ID *uint64 `json:"id"`
}
