from backend.core.config import get_app_settings
from backend.core.root_logger import get_logger
from backend.repos.repository_users import RepositoryUsers
from sqlalchemy.orm import Session

from backend.schemas.user import UserSeeds


logger = get_logger("init_users")
settings = get_app_settings()

def dev_users() -> list[dict]:
  return [
    {
      "username": "sam",
      "password": "admin",
      "name": "Sam",
      "is_admin": True,
      "is_lock": False,
    },
    {
      "username": "duy",
      "password": "admin",
      "name": "Duy",
      "is_admin": True,
      "is_lock": False,
    },
    {
      "username": "sam1",
      "password": "admin",
      "name": "Sam1",
      "is_admin": False,
      "is_lock": False,
    },
  ]

def default_users_init(session: Session):
  users = RepositoryUsers()
  for user in dev_users():
    users.create(session, UserSeeds(**user))
