package validation

import (
	"errors"
	"strings"
)

var (
	ErrMissingCompanyName = errors.New("globalData.companyName is required")
	ErrMissingEmail       = errors.New("globalData.email is required")
	ErrMissingUsername    = errors.New("globalData.username is required")
)

func ValidateBuildGlobalData(globalData map[string]any) error {
	company, _ := globalData["companyName"].(string)
	email, _ := globalData["email"].(string)
	username, _ := globalData["username"].(string)

	if strings.TrimSpace(company) == "" {
		return ErrMissingCompanyName
	}
	if strings.TrimSpace(email) == "" {
		return ErrMissingEmail
	}
	if strings.TrimSpace(username) == "" {
		return ErrMissingUsername
	}
	return nil
}
