package utilities

import (
	"context"
	"fmt"

	"github.com/hashicorp/terraform-plugin-log/tflog"
	"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/rg"
	"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/client"
)

func RGResourceConsumptionListCheckPresence(ctx context.Context, c *client.Client) (*rg.ListResourceConsumption, error) {
	tflog.Info(ctx, "RGResourceConsumptionListCheckPresence: before call CloudBroker().RG().ListResourceConsumption")
	resConsList, err := c.CloudBroker().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 CloudBroker().RG().ListResourceConsumption", map[string]any{"response": resConsList})

	return resConsList, err
}
