"""Flask extension instances.

Extensions are instantiated here without an application so they can be imported
throughout the codebase without creating circular imports. They are bound to the
application inside the factory (:func:`app.create_app`) via ``init_app``.
"""

from flask_login import LoginManager
from flask_mail import Mail
from flask_migrate import Migrate
from flask_sqlalchemy import SQLAlchemy
from flask_wtf import CSRFProtect

# Database ORM and schema migrations.
db = SQLAlchemy()
migrate = Migrate()

# Outbound email.
mail = Mail()

# Cross-site request forgery protection for all state-changing requests.
csrf = CSRFProtect()

# Session-based authentication.
login_manager = LoginManager()
login_manager.login_view = "auth.login"
login_manager.login_message = "Please log in to access this page."
login_manager.login_message_category = "warning"
login_manager.session_protection = "strong"
