package utilities

import (
	"context"
	"fmt"

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

func BServiceSnapshotListDataSourceCheckPresence(ctx context.Context, serviceID uint64, c *client.Client) (*bservice.ListInfoSnapshots, error) {
	tflog.Info(ctx, "BServiceSnapshotListDataSourceCheckPresence: Get deleted list bserivce")

	req := bservice.SnapshotListRequest{ServiceID: serviceID}

	record, err := c.CloudAPI().BService().SnapshotList(ctx, req)

	if err != nil {
		return nil, fmt.Errorf("cannot get bservice snapshots list with error: %w", err)
	}

	return record, err
}
