package utils

import (
	"fmt"

	"penahub.gitlab.yandexcloud.net/pena-services/customer/internal/models"
	"penahub.gitlab.yandexcloud.net/pena-services/customer/pkg/validate"
)

func ValidateConfigurationURLs(config *models.ServiceConfiguration) error {
	return validateAuthMicroserviceURLs(&config.AuthMicroservice.URL)
}

func validateAuthMicroserviceURLs(urls *models.AuthMicroserviceURL) error {
	if !validate.URL(urls.User) {
		return fmt.Errorf("invalid auth user url: %s", urls.User)
	}

	return nil
}
