export type OidcRuntimeConfig = {
  /** OIDC issuer (Authentik application), trailing slash included. */
  issuer: string
  /** Public OIDC client id (mobile = public PKCE client, no secret). */
  clientId: string
  /** Native redirect URI, e.g. `ultimail://oauth/callback`. */
  redirectUri: string
  authorizationEndpoint: string
  tokenEndpoint: string
  endSessionEndpoint: string
  /** Optional Authentik enrollment (sign-up) flow URL. */
  enrollmentUrl?: string
}

/**
 * Everything the static frontend needs to talk to one backend instance. On web
 * this is derived from build-time `NEXT_PUBLIC_*` env; on native it is chosen at
 * runtime via the server picker (UltiSpace preset or self-hosted URL) and
 * persisted to the OS secure store.
 */
export type RuntimeConfig = {
  /** Human label shown in the picker / account UI. */
  label: string
  /** Instance origin, e.g. `https://space.ulti`. */
  instanceOrigin: string
  /** Absolute backend base, e.g. `https://space.ulti/api/v1`. */
  apiBaseUrl: string
  /** Absolute realtime WS URL, e.g. `wss://space.ulti/ws`. */
  wsUrl: string
  oidc: OidcRuntimeConfig
  /** Optional product extras (resolved from instance origin). */
  aiOrigin?: string
  aiPublicPath?: string
  onlyOfficeUrl?: string
  hocuspocusUrl?: string
}
