interface ImaDaiConfiguration {
    /**
     * The URL of your self-hosted IMA DAI SDK.
     * Defaults to `'//imasdk.googleapis.com/js/sdkloader/ima3_dai.js'`
     */
    sdkUrl: string;
    /**
     * Whether to skip over ads that have already played when seeking.
     * Defaults to `true`
     */
    skipPlayedAds: boolean;
    /**
     * If true, it hides overlays while ads are playing.
     * Defaults to `false`
     */
    hideOverlays: boolean;
}

interface KeySystemConfig {
    licenseServerUri: string;
    serverCertificateUri?: string;
    serverCertificate?: Uint8Array;
    persistentState?: MediaKeysRequirement;
    distinctiveIdentifier?: MediaKeysRequirement;
    videoRobustness?: string;
    audioRobustness?: string;
    sessionType?: MediaKeySessionType;
    getContentId?: (contentId: string) => string;
}
type SourceKeySystems = Record<string, KeySystemConfig>;
interface Source {
    mimeType: string;
    url: string;
    keySystems?: SourceKeySystems;
    vmap?: string;
}

/**
 * See: {@link https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/html5/reference/js/StreamRequest}
 */
interface StreamRequest {
    adTagParameters: unknown | null;
    apiKey: string;
    authToken: string;
    format: string;
    omidAccessModeRules: unknown;
    streamActivityMonitorId: string;
}
interface ImaDaiIntegrationLoadOptions {
    streamRequest: StreamRequest;
    /**
     * A fallback stream to use if the IMA DAI SDK fails to get a stream
     */
    fallbackSource: Source;
    /**
     * A function to resolve the source URL for a pod stream by replacing the placeholder in the provided URL with the given stream ID. Should return valid source object.
     */
    podSourceResolver?: (streamId: string) => Source;
}
interface ImaDaiIntegration {
    /**
     * Request a stream via the IMA DAI SDK or fallback to a provided fallback stream
     */
    load(options: ImaDaiIntegrationLoadOptions): void;
    /**
     * Check if the IMA DAI stream is playing. Returns true if it is, false otherwise.
     */
    getIsImaDaiStream(): boolean;
    /**
     * Getter for the content duration (without ads).
     */
    getContentDuration(): number;
    /**
     * Get the current ad duration if in ad mode, or content duration without ads otherwise.
     */
    getRelativeDuration(): number;
    /**
     * Whether it is possible to perform a seek now.
     */
    getCanSeekNow(): boolean;
    /**
     * Get the current time for the current ad if in ad mode, or current content time (without ads) otherwise.
     */
    getRelativeCurrentTime(): number;
    /**
     * Get the total duration of all known ads (applicable for VOD only).
     */
    getTotalAdsDuration(): number;
    /**
     * Convert a given content time to stream time with ads.
     */
    convertContentTimeToStreamTime(contentTime: number): number;
    /**
     * Convert a given stream time to content time without ads.
     */
    convertStreamTimeToContentTime(streamTime: number): number;
    /** @internal */
    updateConfiguration(imaDaiConfiguration: ImaDaiConfiguration, prev: ImaDaiConfiguration): void;
    /** @internal */
    dispose(): void;
}

type ImaDaiIntegrationFactory = new (...args: Array<unknown>) => ImaDaiIntegration;

export type { ImaDaiIntegrationFactory };
