package utilities

import (
	"context"
	"fmt"

	"github.com/hashicorp/terraform-plugin-log/tflog"
	"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/client"
)

func ExtNetDefaultCheckPresence(ctx context.Context, c *client.Client) (uint64, error) {
	tflog.Info(ctx, "ExtNetDefaultCheckPresence: Get info about default extnet with ID - %v")

	netId, err := c.CloudAPI().ExtNet().GetDefault(ctx)
	if err != nil {
		return 0, fmt.Errorf("ExtNetDefaultCheckPresence: cannot get info about extnet with error: %w", err)
	}

	tflog.Info(ctx, "ExtNetDefaultCheckPresence: response from CloudAPI().ExtNet().GetDefault", map[string]any{"response": netId})

	return netId, err
}
