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

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