from app import app, db
from models import User

def init_admin():
    with app.app_context():
        admin = User.query.filter_by(email='administrator@docupulse.com').first()
        if not admin:
            admin = User(
                username='administrator',
                email='administrator@docupulse.com',
                last_name='None',
                company='docupulse',
                is_admin=True,
                is_active=True
            )
            admin.set_password('q]H488h[8?.A')
            db.session.add(admin)
            db.session.commit()
            print("Default administrator user created successfully.")
        else:
            print("Admin user already exists.")

if __name__ == '__main__':
    init_admin() 