"""
Flask application factory for INDEX-SISTEM-JOCURI v2.0
"""

from flask import Flask
from app.config import Config

def create_app(config_class=Config):
    """Create Flask application instance"""
    # Set correct template and static directories
    import os
    template_dir = os.path.join(os.path.dirname(__file__), 'templates')
    static_dir = os.path.join(os.path.dirname(__file__), 'static')
    
    app = Flask(__name__, template_folder=template_dir, static_folder=static_dir)
    app.config.from_object(config_class)
    
    # Register blueprints
    from app.web.routes import bp as main_bp
    app.register_blueprint(main_bp)
    
    return app