package utilities

import (
	"context"

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

func VINSStaticRouteListDataSourceCheckPresence(ctx context.Context, vinsId uint64, c *client.Client) (*vins.ListStaticRoutes, diag.Diagnostics) {
	tflog.Info(ctx, "VINSStaticRouteListDataSourceCheckPresence: Get info about vins static route list")

	diags := diag.Diagnostics{}

	routesList, err := c.CloudAPI().VINS().StaticRouteList(ctx, vins.StaticRouteListRequest{VINSID: vinsId})
	if err != nil {
		diags.AddError("Cannot get info about vins static route list", err.Error())
		return nil, diags
	}
	tflog.Info(ctx, "VINSStaticRouteListDataSourceCheckPresence: successfull response from CloudAPI().VINS().StaticRouteList")

	return routesList, nil
}
