# App route blueprints
from all_paw_care.forms import forms 
from all_paw_care.pages import pages
from all_paw_care.users import users
from all_paw_care.db.actions import ensure_tables

# App config
from config import Config

# Flask
from flask import Flask

# SQLAlchemy
from sqlalchemy import create_engine
from sqlalchemy.orm import Session

def create_app():
    # Initialize app
    all_paw_care = Flask(__name__)

    # Import config
    all_paw_care.config.from_object(Config)

    # Register app blueprints
    all_paw_care.register_blueprint(pages)
    all_paw_care.register_blueprint(forms)
    all_paw_care.register_blueprint(users)

    # Ensure database tables
    ensure_tables()

    return all_paw_care

