from flask import Flask 
from flask_cors import CORS 
from .routes .main import main_bp 
from .routes .rag import rag_bp 
from .routes .gemini import gemini_bp 

def create_app ():
    app =Flask (__name__ )
    CORS (app )

    app .register_blueprint (main_bp )
    app .register_blueprint (rag_bp ,url_prefix ='/api/rag')
    app .register_blueprint (gemini_bp ,url_prefix ='/api/gemini')
    from .routes .reports import reports_bp 
    app .register_blueprint (reports_bp ,url_prefix ='/api/reports')
    from .routes .incidents import incidents_bp 
    app .register_blueprint (incidents_bp ,url_prefix ='/api/incidents')

    return app 

