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 VINSNATRuleListDataSourceCheckPresence(ctx context.Context, vinsId uint64, c *client.Client) (*vins.ListNATRules, diag.Diagnostics) {
	tflog.Info(ctx, "VINSNATRuleListDataSourceCheckPresence: Get info about vins nat rule list")

	diags := diag.Diagnostics{}

	natRuleList, err := c.CloudAPI().VINS().NATRuleList(ctx, vins.NATRuleListRequest{VINSID: vinsId})
	if err != nil {
		diags.AddError("Cannot get info about vins nat rule list", err.Error())
		return nil, diags
	}
	tflog.Info(ctx, "VINSNATRuleListDataSourceCheckPresence: successfull response from CloudAPI().VINS().NATRuleList")

	return natRuleList, nil
}
