import { Observable } from 'rxjs';

export interface QrLoginSessionStart {
  webSessionID: string;
  url: string;
}

export type QrLoginStatus = 'loading' | 'ready' | 'expired' | 'error';

/**
 * Adapter every QR-login surface (customer Telegram login, admin login, ...)
 * implements so QrLoginEngine can drive session creation/polling without
 * knowing which auth service or storage backs it.
 */
export interface QrLoginAdapter<TSession> {
  createSession(): Observable<QrLoginSessionStart>;
  checkSessionOnce(webSessionID: string): Observable<TSession | null>;
  isSessionActive(session: TSession | null): boolean;
  getAppLoginUrl(webSessionID: string): string;
  onLoginComplete(): void;
}
