package compute

import (
	"context"
	"net/http"

	"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)

// SharedSnapshotMergeStatusRequest struct to get shared snapshot merge status
type SharedSnapshotMergeStatusRequest struct {
	// ID of compute instance to get log for
	// Required: true
	ComputeID uint64 `url:"compute_id" json:"compute_id" validate:"required"`
}

// SharedSnapshotMergeStatus shared snapshots merge status
// returns a string representing either the current status or the progress percentage
func (c Compute) SharedSnapshotMergeStatus(ctx context.Context, req SharedSnapshotMergeStatusRequest) (string, error) {
	err := validators.ValidateRequest(req)
	if err != nil {
		return "", validators.ValidationErrors(validators.GetErrors(err))
	}

	url := "/cloudbroker/compute/shared_snapshot_merge_status"

	res, err := c.client.DecortApiCall(ctx, http.MethodGet, url, req)
	if err != nil {
		return "", err
	}

	return string(res), nil
}
