from typing import Optional

from sqlalchemy.orm import Session

from src.db.models.admin import Profile


def get_profile_by_username(username: str, db: Session) -> Optional[Profile]:
    profile = db.query(Profile).filter(Profile.user_name == username).first()
    return profile

def get_profile_by_email(email: str, db: Session) -> Optional[Profile]:
    profile = db.query(Profile).filter(Profile.email == email).first()
    return profile

def is_database_empty(db: Session) -> bool:
    profiles = db.query(Profile).all()
    return len(profiles) == 0
