// Define the shape of the imported 'api' object based on usage in the original code.
interface NativeApi {
  fullscreenEnabled: keyof Document;
  fullscreenElement: keyof Document;
  requestFullscreen: keyof HTMLElement;
  exitFullscreen: keyof Document;
}

declare const api: NativeApi;

// Define constants with their respective types
declare const FULLSCREEN_CHANGE_EVENT: "fullscreenchange";
declare const FULLSCREEN_ERROR_EVENT: "fullscreenerror";
declare const FULLSCREEN_EXIT_KEY: 27; // keyCode for Esc key
declare const FULLSCREEN_REQUEST_KEY: 122; // keyCode for F11 key

// Event listener type
type EventListener = (event: Event) => void;

// Main screenfull functions and properties type definitions
interface Screenfull {
  request(element?: HTMLElement, options?: any): Promise<void> | undefined;
  requestFullscreen(
    element?: HTMLElement,
    options?: any
  ): Promise<void> | undefined;
  exit(element?: HTMLElement): Promise<void> | undefined;
  exitFullscreen(element?: HTMLElement): Promise<void> | undefined;
  onChange(callback: EventListener): void;
  fullscreenchange(callback: EventListener): void;
  fullscreenEnabled(): boolean;
  isFullscreen(): boolean;
  fullscreenElement(): HTMLElement | null;
  onError(callback: EventListener): void;
  fullscreenerror(callback: EventListener): void;
  isEnabled: boolean;
  isFull: boolean;
  fullElement: HTMLElement | null;
}

// Define properties added via Object.defineProperties
interface ScreenfullExtended extends Screenfull {
  isEnabled: boolean;
  isFull: boolean;
  fullElement: HTMLElement | null;
}
declare const screenfull: ScreenfullExtended;

// Export the screenfull object for external use
export default screenfull;
