import videojs from 'video.js';

declare module 'video.js' {
  export interface VideoJsPlayer {
    qualityLevels(): QualityLevelList;
  }
}

declare module 'videojs-contrib-quality-levels' {
  export interface QualityLevelList extends videojs.EventTarget {
    [id: string]: QualityLevel;
    selectedIndex: number;
    length: number;
    addQualityLevel(representation: Representation): QualityLevel;
    removeQualityLevel(qualityLevel: QualityLevel): QualityLevel;
    getQualityLevelById(id: string): QualityLevel;
  }

  export interface QualityLevel {
    id: string;
    label: string;
    // The user-facing label from the server (e.g. "720p"), set manually after addQualityLevel
    displayName: string;
    // The playback quality (e.g. 720), set manually after addQualityLevel
    quality: number;
    enabled: boolean;
  }

  export interface Representation {
    id: string;
    enabled(enabled: boolean): boolean;
  }
}