export function presentAdminUser<T extends Record<string, any>>(admin: T) {
  const { passwordHash, totpSecret, ...safe } = admin
  return safe
}

export function presentAdminSession<T extends Record<string, any>>(admin: T, token: string) {
  return {
    token,
    admin: presentAdminUser(admin),
  }
}

export function presentPaginated<T>(
  data: T[],
  total: number,
  page: number,
  pageSize: number,
  extra: Record<string, unknown> = {},
) {
  return {
    data,
    total,
    page,
    pageSize,
    totalPages: Math.ceil(total / pageSize),
    ...extra,
  }
}
