package utilities

import (
	"context"

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

func ComputeGetAuditsCheckPresence(ctx context.Context, state *models.GetAuditsModel, c *client.Client) (*compute.ListShortAudits, error) {
	tflog.Info(ctx, "Get compute short audits info")

	req := compute.GetAuditsRequest{
		ComputeID: uint64(state.ComputeID.ValueInt64()),
	}

	tflog.Info(ctx, "Check req", map[string]any{"req": req})

	auditsShortList, err := c.CloudAPI().Compute().GetAudits(ctx, req)
	if err != nil {
		return nil, err
	}

	tflog.Info(ctx, "Getting compute short audits, successfully")
	return &auditsShortList, nil
}
