import * as plugins from '../../plugins.js';
import type { AdminHandler } from '../handlers/admin.handler.js';
import * as interfaces from '../../../ts_interfaces/index.js';

export async function requireValidIdentity<T extends { identity?: interfaces.data.IIdentity }>(
  adminHandler: AdminHandler,
  dataArg: T,
): Promise<interfaces.data.IIdentity> {
  return await adminHandler.getVerifiedIdentity(dataArg.identity);
}

export async function requireAdminIdentity<T extends { identity?: interfaces.data.IIdentity }>(
  adminHandler: AdminHandler,
  dataArg: T,
): Promise<interfaces.data.IIdentity> {
  return await adminHandler.getVerifiedAdminIdentity(dataArg.identity);
}
