package utilities

import (
	"context"
	"fmt"

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

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

	record, err := c.CloudAPI().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 CloudAPI().Account().ListResourceConsumption",
		map[string]any{"response": record})

	return record, err
}
