import {useGetAllUsersQuery} from "../../../Api/usersApi.js";
import {useGetRolesQuery} from "../../../Api/rolesApi.js";

const useAdminPage = () => {
    const {
        data: users = [], isLoading, isError,
    } = useGetAllUsersQuery(undefined, {
        pollingInterval: 10000,
    });

    const {data: roles = [], isLoading: isLoadingRoles, isError: isErrorRoles} = useGetRolesQuery(undefined, {
        pollingInterval: 60000,
    });

    // const [updateUser, { isLoading: isUpdating, isError: isUpdateError }] = useUpdateUserMutation();
    // const [createUser, { isLoading: isCreating, isError: isCreateError }] = useCreateUserMutation();

    return {
        users,
        roles,
        isLoading: isLoading || isLoadingRoles,
        isError: isError || isErrorRoles,
        updateUser: () => {
        }, isUpdating: false, isUpdateError: false, createUser: () => {
        }, isCreating: false, isCreateError: false,
    };
};

export default useAdminPage;