from sqlalchemy.orm import Session
from sqlmodel import select
from sqlalchemy.exc import SQLAlchemyError
from typing import Any

# import sys
#
# sys.path.append("..")
from app.db import models, pagination,session_scope
from app.util import passutil, schemas
from app.logs import fastapi_logger
from app.crud import get_user,get_user_password


class CRUDLogin:

    def check_username_password(self, email: str, password: str) -> Any:
        """ Verify Password"""

        db_user_info = get_user_password(email=email)

        return passutil.verify_password(str(password),
                                        str(db_user_info.password))

    def check_active_session(self, session_id: str):
        """ check for active session """
        try:
            with session_scope() as db:
                statement = 