import { getIaaaClientConfig } from "@/server/service/iaaa"
import { LoginForm } from "./login-form"

export interface IaaaClientConfig {
  enabled: boolean
  appId: string
  callbackPath: string
  autoRedirect: boolean
  /** 开发模式下未配置 IAAA，需要显示配置提醒 */
  showInDev: boolean
}

export default function LoginPage() {
  const config = getIaaaClientConfig()
  const isDev = process.env.NODE_ENV === 'development'

  const iaaaConfig: IaaaClientConfig = {
    ...config,
    showInDev: isDev && !config.enabled,
  }

  return <LoginForm iaaaConfig={iaaaConfig} />
}
