from sqladmin import Admin, ModelView
from fastapi import FastAPI
from sqlalchemy.engine import Engine

from ..auth.models import User
from ..profiles.models import Profile

class UserAdmin(ModelView, model=User):
    column_list = [User.id, User.email, User.is_superuser, User.is_active]

class ProfileAdmin(ModelView, model=Profile):
    column_list = [Profile.id, Profile.full_name, Profile.user_id]

def setup_admin(app: FastAPI, engine: Engine):
    admin = Admin(app, engine)
    admin.add_view(UserAdmin)
    admin.add_view(ProfileAdmin)
