declare module 'passport-azure-ad' {
  import { Request } from 'express';
  
  export interface IBearerStrategyOptions {
    identityMetadata: string;
    clientID: string;
    validateIssuer?: boolean;
    issuer?: string[];
    passReqToCallback?: boolean;
    isB2C?: boolean;
    allowMultiAudiencesInToken?: boolean;
    audience?: string;
    loggingLevel?: string;
    loggingNoPII?: boolean;
    scope?: string[];
    clientSecret?: string;
    tenantIdOrName?: string;
  }
  
  export interface ITokenPayload {
    aud: string;
    iss: string;
    sub: string;
    tid: string;
    nbf: number;
    exp: number;
    ver: string;
    iat: number;
    given_name?: string;
    family_name?: string;
    upn?: string;
    name?: string;
    nonce?: string;
    oid?: string;
    preferred_username?: string;
    email?: string;
    [key: string]: any;
  }
  
  export interface VerifyCallback {
    (err: Error | null, user?: any, info?: any): void;
  }
  
  export class BearerStrategy {
    constructor(options: IBearerStrategyOptions, verify: (token: ITokenPayload, done: VerifyCallback) => void);
    name: string;
  }
  
  export interface IOIDCStrategyOptions {
    identityMetadata: string;
    clientID: string;
    clientSecret: string;
    responseType?: string;
    responseMode?: string;
    redirectUrl: string;
    allowHttpForRedirectUrl?: boolean;
    validateIssuer?: boolean;
    issuer?: string[];
    passReqToCallback?: boolean;
    scope?: string[];
    loggingLevel?: string;
    loggingNoPII?: boolean;
    nonceLifetime?: number;
    nonceMaxAmount?: number;
    useCookieInsteadOfSession?: boolean;
    cookieEncryptionKeys?: Array<{ key: string; iv: string }>;
    clockSkew?: number;
  }
  
  export interface IOIDCStrategyOptionWithRequest extends IOIDCStrategyOptions {
    passReqToCallback: true;
  }
  
  export class OIDCStrategy {
    constructor(
      options: IOIDCStrategyOptionWithRequest,
      verify: (req: Request, profile: any, done: VerifyCallback) => void
    );
    constructor(
      options: IOIDCStrategyOptions,
      verify: (profile: any, done: VerifyCallback) => void
    );
    name: string;
  }
}