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 BServiceDataSourceCheckPresence(ctx context.Context, serviceId uint64, c *client.Client) (*bservice.RecordBasicService, error) {
	tflog.Info(ctx, fmt.Sprintf("BServiceDataSourceCheckPresence: Get info about bserivce  with  ID - %v", serviceId))

	record, err := c.CloudAPI().BService().Get(ctx, bservice.GetRequest{ServiceID: serviceId})

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

	return record, err
}
