package controlplane

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

type CreateDeploymentReq struct {
	Scenario cp.Scenario       `json:"scenario" binding:"required"`
	Params   map[string]string `json:"params" binding:"required"`
}

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

	ID uint64 `json:"id"`
}

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

	Deployment *cp.Deployment `json:"deployment"`
}

type ListDeploymentReq struct {
	api.PaginationReq

	Scenario string `form:"scenario"`
	Phase    string `form:"phase"`
}

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

	Deployments []*cp.Deployment `json:"items"`
}

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

	RunID  int64  `json:"run_id"`
	RunURL string `json:"run_url"`
}

type OnPreviewCompleteReq struct {
	RunID   int64  `json:"run_id"`
	RunURL  string `json:"run_url"`
	Status  string `json:"status" binding:"required"`
	Summary string `json:"summary"`
}

type OnApplyCompleteReq struct {
	RunID  int64  `json:"run_id"`
	RunURL string `json:"run_url"`
	Status string `json:"status" binding:"required"`
}
