package utilities

import (
	"context"
	"fmt"

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

func AccountGetResourceConsumptionListDataSourceCheckPresence(ctx context.Context, c *client.Client) (*account.ListResources, error) {
	tflog.Info(ctx, "AccountGetResourceConsumptionListDataSourceCheckPresence: Get info about account resource consumption list")

	record, err := c.CloudBroker().Account().ListResourceConsumption(ctx)
	if err != nil {
		return nil, fmt.Errorf("cannot get info about resource with error: %w", err)
	}

	tflog.Info(ctx, "AccountGetResourceConsumptionListDataSourceCheckPresence: response from CloudBroker().Account().ListResourceConsumption",
		map[string]any{"response": record})

	return record, err
}
