// passport-kakao 공식 타입 미제공 — 사용 범위에 맞춘 최소 선언.
declare module 'passport-kakao' {
  export interface KakaoProfile {
    id: number | string;
    username?: string;
    displayName?: string;
    _json?: {
      id: number;
      kakao_account?: {
        email?: string;
        // 카카오 이메일 보유/검증 플래그 — 미검증 이메일은 신뢰하지 않는다
        has_email?: boolean;
        is_email_verified?: boolean;
        profile?: {
          nickname?: string;
          profile_image_url?: string;
          thumbnail_image_url?: string;
        };
      };
      properties?: {
        nickname?: string;
        profile_image?: string;
        thumbnail_image?: string;
      };
    };
  }

  export interface StrategyOptions {
    clientID: string;
    clientSecret?: string;
    callbackURL: string;
    // passport-oauth2 호환 state 저장소(OAuth CSRF 방지)
    store?: unknown;
  }

  export type VerifyCallback = (
    error: unknown,
    user?: unknown,
    info?: unknown,
  ) => void;

  export class Strategy {
    constructor(
      options: StrategyOptions,
      verify: (
        accessToken: string,
        refreshToken: string,
        profile: KakaoProfile,
        done: VerifyCallback,
      ) => void,
    );
    name: string;
    authenticate(req: unknown, options?: unknown): void;
  }
}
