from flask import Flask
from app.database import db
from app.routes.user_routes import user_bp
from app.routes.invoice_routes import invoice_bp

def create_app():
    app = Flask(__name__)
    app.config.from_object("config")
    
    db.init_app(app)

    # Registrar blueprints
    app.register_blueprint(user_bp, url_prefix="/users")
    app.register_blueprint(invoice_bp, url_prefix="/invoices")

    return app
