"""FastAPIサーバーの起動・終了イベントのラッパー"""

from typing import Callable

from fastapi import FastAPI

from src.db.tasks import close_db, init_db


def create_start_app_handler(app: FastAPI) -> Callable:
    def start_app() -> None:
        init_db(app)

    return start_app


def create_stop_app_handler(app: FastAPI) -> Callable:
    def stop_app() -> None:
        close_db(app)

    return stop_app
