from dbActions.users import Users
import hashlib
import os

def create_super_user():
    users_manager = Users()

    email = 'magdalena.macamete@gmail.com'
    name = 'Magdalena Macamete' 
    phone = ''
    address = '' 
    role = 'admin'

    # check if user already exists
    if not users_manager.get_user(email):
        users_manager.invite_user(email, name, phone, address, role)
        print(f"Super user created: {email} (role={role})")
    else:
        print(f"Super user already created created: {email})")

if __name__ == "__main__":
    try:
        create_super_user()
    except Exception as e:
        print(f"Failed to create super user: {e}")