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/account"
)

func AccountGetResourceConsumptionListDataSourceCheckPresence(ctx context.Context, c *decort.DecortClient) (*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
}
