package services

import "errors"

// Common service errors
var (
	// ErrUserAlreadyExists is returned when trying to create a user that already exists
	ErrUserAlreadyExists = errors.New("user already exists")
	
	// ErrInvalidCredentials is returned when login credentials are invalid
	ErrInvalidCredentials = errors.New("invalid credentials")
	
	// ErrUserNotFound is returned when a user is not found
	ErrUserNotFound = errors.New("user not found")
	
	// ErrInvalidToken is returned when a token is invalid or expired
	ErrInvalidToken = errors.New("invalid or expired token")
	
	// ErrWeakPassword is returned when password doesn't meet requirements
	ErrWeakPassword = errors.New("password does not meet security requirements")
	
	// ErrInvalidEmail is returned when email format is invalid
	ErrInvalidEmail = errors.New("invalid email format")
)

// IsUserAlreadyExistsError checks if the error is a user already exists error
func IsUserAlreadyExistsError(err error) bool {
	return errors.Is(err, ErrUserAlreadyExists)
}

// IsInvalidCredentialsError checks if the error is an invalid credentials error
func IsInvalidCredentialsError(err error) bool {
	return errors.Is(err, ErrInvalidCredentials)
}

// IsUserNotFoundError checks if the error is a user not found error  
func IsUserNotFoundError(err error) bool {
	return errors.Is(err, ErrUserNotFound)
}

// IsInvalidTokenError checks if the error is an invalid token error
func IsInvalidTokenError(err error) bool {
	return errors.Is(err, ErrInvalidToken)
}

// IsWeakPassword checks if the error is a weak password error
func IsWeakPassword(err error) bool {
	return errors.Is(err, ErrWeakPassword)
}

// IsInvalidEmail checks if the error is an invalid email error
func IsInvalidEmail(err error) bool {
	return errors.Is(err, ErrInvalidEmail)
}