export function useGrateWizard() {
  const appConfig = useAppConfig()

  function launch() {
    const { url, popup } = appConfig.gratewizard as { url: string; popup: { width: number; height: number } }
    const left = Math.round((window.screen.width - popup.width) / 2)
    const top = Math.round((window.screen.height - popup.height) / 2)
    window.open(
      url,
      'GrateWizard',
      `width=${popup.width},height=${popup.height},left=${left},top=${top},scrollbars=yes,resizable=yes`,
    )
  }

  return { launch }
}
