package vfpool

import (
	"context"

	"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
	"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
	"repository.basistech.ru/BASIS/terraform-provider-decort/internal/dc"
	"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/ic"
)

func checkParamsExistence(ctx context.Context, c *controller.ControllerCfg, accountIDs, rgIDs []uint64) diag.Diagnostics {
	var errs []error

	if err := ic.ExistAccouts(ctx, accountIDs, c); err != nil {
		errs = append(errs, err)
	}

	if err := ic.ExistRGs(ctx, rgIDs, c); err != nil {
		errs = append(errs, err)
	}

	return dc.ErrorsToDiagnostics(errs)
}
