from __future__ import annotations

from flask import Flask

from .config import BASE_DIR, SECRET_KEY
from .db import init_db
from .routes import bp


def create_app() -> Flask:
    app = Flask(
        __name__,
        template_folder=str(BASE_DIR / "templates"),
        static_folder=str(BASE_DIR / "static"),
    )
    app.secret_key = SECRET_KEY
    app.register_blueprint(bp)
    init_db()
    return app


app = create_app()
