import UserList from "../../../Models/Users/Users";
import { connect } from "mongoose";
import {
    SysAdminPaginateUsersParams,
    SysAdminUpdateProfileParams,
    SysAdminSetVerifiedParams,
    SysAdminDeleteUserParams,
    SysAdminOrganizationsStatusParams,
    SysAdminUserOrganizationsResult,
    PaginateUsersResults,
} from "../../../Models/Users/Users.Interface";

export class SysAdminUsersService {
    public async paginateUsers(
        params: SysAdminPaginateUsersParams
    ): Promise<PaginateUsersResults> {
        await connect(`${process.env.DATABASE_CONNECTION}`);
        return await UserList.sysAdminPaginateUsers(params);
    }

    public async updateProfile(params: SysAdminUpdateProfileParams): Promise<void> {
        await connect(`${process.env.DATABASE_CONNECTION}`);
        await UserList.sysAdminUpdateProfile(params);
    }

    public async setVerifiedStatus(params: SysAdminSetVerifiedParams): Promise<void> {
        await connect(`${process.env.DATABASE_CONNECTION}`);
        await UserList.sysAdminSetVerifiedStatus(params);
    }

    public async organizationsStatus(
        params: SysAdminOrganizationsStatusParams
    ): Promise<SysAdminUserOrganizationsResult> {
        await connect(`${process.env.DATABASE_CONNECTION}`);
        return await UserList.sysAdminOrganizationsStatus(params);
    }

    public async deleteUser(params: SysAdminDeleteUserParams): Promise<void> {
        await connect(`${process.env.DATABASE_CONNECTION}`);
        await UserList.sysAdminDeleteUser(params);
    }
}
