package utilities

import (
	"context"
	"fmt"

	"github.com/hashicorp/terraform-plugin-log/tflog"
	decort "repository.basistech.ru/BASIS/decort-golang-sdk"
	"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/rg"
)

func RGResourceConsumptionListCheckPresence(ctx context.Context, c *decort.DecortClient) (*rg.ListResourceConsumption, error) {
	tflog.Info(ctx, "RGResourceConsumptionListCheckPresence: before call CloudAPI().RG().ListResourceConsumption")
	resConsList, err := c.CloudAPI().RG().ListResourceConsumption(ctx)
	if err != nil {
		return nil, fmt.Errorf("cannot get info about resource group resource consumption list with error: %w", err)
	}

	tflog.Info(ctx, "RGResourceConsumptionListCheckPresence: response from CloudAPI().RG().ListResourceConsumption", map[string]any{"response": resConsList})

	return resConsList, err
}
