package zone

import (
	"context"
	"net/http"
	"strconv"

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

// DeleteCPUAlignmentProfileRequest struct to delete CPU alignment profile from zone
type DeleteCPUAlignmentProfileRequest struct {
	// ID of zone
	// Required: true
	ZoneID uint64 `url:"zone_id" json:"zone_id" validate:"required"`
}

// DeleteCPUAlignmentProfile deletes CPU alignment profile from zone
func (e Zone) DeleteCPUAlignmentProfile(ctx context.Context, req DeleteCPUAlignmentProfileRequest) (bool, error) {
	err := validators.ValidateRequest(req)
	if err != nil {
		return false, validators.ValidationErrors(validators.GetErrors(err))
	}

	url := "/cloudbroker/zone/delete_cpu_alignment_profile"

	res, err := e.client.DecortApiCall(ctx, http.MethodPost, url, req)
	if err != nil {
		return false, err
	}

	result, err := strconv.ParseBool(string(res))
	if err != nil {
		return false, err
	}

	return result, nil
}
