package utils

import (
	"GoMembership/internal/constants"
	"GoMembership/internal/models"
)

func HasPrivilige(user *models.User, privilige int8) bool {
	switch privilige {
	case constants.Priviliges.View:
		return user.RoleID >= constants.Roles.Viewer
	case constants.Priviliges.Update:
		return user.RoleID >= constants.Roles.Editor
	case constants.Priviliges.Create:
		return user.RoleID >= constants.Roles.Editor
	case constants.Priviliges.Delete:
		return user.RoleID >= constants.Roles.Editor
	default:
		return false
	}

}
