package response

import (
	"time"

	"github.com/pingcap/test-infra/common/model"
	"github.com/pingcap/test-infra/common/model/resource"
)

type CreateTestbedResponse struct {
	Name  string                `json:"name"`
	Items []TestbedResponseItem `json:"items"`
}

type GetTestbedResponse struct {
	Name  string                `json:"name"`
	Items []TestbedResponseItem `json:"items,omitempty"`
	Lease *LeaseResponse        `json:"lease,omitempty"`
}

type CheckTestbedResponse struct {
	Name    string              `json:"name"`
	Status  model.TestBedStatus `json:"status"`
	Message string              `json:"message"`
}

type RestoreMonitorResponse struct {
	TestbedName string `json:"testbedName"`
	GrafanaURL  string `json:"grafanaURL"`
}

type ListTestbedResponse struct {
	Items []GetTestbedResponse `json:"items"`
}

type TestbedResponseItem resource.Item

type CredentialResponse struct {
	Status     string `json:"status"`
	ID         string `json:"id,omitempty"`
	Credential []byte `json:"credential,omitempty"`
}

type RenewalLeaseResponse struct {
	// Name is the testbed's name
	Name string `json:"name"`
	// ExpireDate is the testbed's expire date
	ExpireDate string `json:"expireDate"`
}

type LeaseResponse struct {
	// Lease is the testbed's lease duration
	Lease string `json:"lease"`
	// ExpireDate is the testbed's expire date
	ExpireDate string `json:"expireDate"`
}

type GetResourcePoolStatusResponse struct {
	TotalResource        model.PhysicalResource `json:"totalResource,omitempty"`
	NonTestbedOccupation model.PhysicalResource `json:"nonTestbedOccupation,omitempty"`
}

type GetTestbedsResourceResponse struct {
	TestbedsOccupation map[string]*model.PhysicalResource `json:"testbedsOccupation,omitempty"`
}

type GetTestbedResourceOvertimeResponse struct {
	AverageTestBedPhysicalResource model.PhysicalResource `json:"averageTestBedPhysicalResource"`
	MaxTestBedPhysicalResource     model.PhysicalResource `json:"maxTestBedPhysicalResource"`
}

type GetLogLinksResponse struct {
	LogLinks map[string]string `json:"logLinks"`
}

type GetShootKubeConfigResponse struct {
	KubeConfig []byte `json:"kubeConfig,omitempty"`
}

type GetTemporaryECRImageSyncCredentialResponse struct {
	// The access key ID that identifies the temporary security credentials.
	//
	// This member is required.
	AccessKeyId *string

	// The date on which the current credentials expire.
	//
	// This member is required.
	Expiration *time.Time

	// The secret access key that can be used to sign requests.
	//
	// This member is required.
	SecretAccessKey *string

	// The token that users must pass to the service API to use the temporary
	// credentials.
	//
	// This member is required.
	SessionToken *string
}
