/*---------------------------------------------------------------------------------------------
 * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
 * See LICENSE.md in the project root for license terms and full copyright notice.
 *--------------------------------------------------------------------------------------------*/
/** @packageDocumentation
 * @module ContentView
 */
import "./DefaultViewOverlay.scss";
import * as React from "react";
import { SolarTimeline, TimelineComponent, } from "@itwin/imodel-components-react";
import { useScheduleAnimationDataProvider } from "../hooks/useScheduleAnimationDataProvider.js";
import { useActiveViewport } from "../hooks/useActiveViewport.js";
import { useSolarDataProvider } from "../hooks/useSolarDataProvider.js";
import { useAnalysisAnimationDataProvider } from "../hooks/useAnalysisAnimationDataProvider.js";
/**
 * Default viewport overlay that examines ViewState of the active view for a schedule script, analysis data, or solar data. If one of these is detected, the corresponding
 * data provider is attached to the TimelineComponent and the overlay is made visible.
 * @public
 */
export function DefaultViewOverlay({ viewport, onPlayPause, 
// eslint-disable-next-line @typescript-eslint/no-deprecated
featureOptions, ...props }) {
    const solarDataTimelineProvider = useSolarDataProvider(viewport);
    const analysisAnimationTimelineDataProvider = useAnalysisAnimationDataProvider(viewport);
    const scheduleTimelineDataProvider = useScheduleAnimationDataProvider(viewport);
    const currentViewport = useActiveViewport();
    if (!currentViewport)
        return null;
    // Solar gets first shot
    const enableSolarTimelineViewOverlay = props.solarTimeline ??
        featureOptions?.defaultViewOverlay?.enableSolarTimelineViewOverlay;
    if (solarDataTimelineProvider && enableSolarTimelineViewOverlay) {
        return (React.createElement("div", { className: "uifw-view-overlay" },
            React.createElement("div", { className: "uifw-animation-overlay" },
                React.createElement(SolarTimeline, { dataProvider: solarDataTimelineProvider }))));
    }
    const enableAnalysisTimelineViewOverlay = props.analysisTimeline ??
        featureOptions?.defaultViewOverlay?.enableAnalysisTimelineViewOverlay;
    if (analysisAnimationTimelineDataProvider &&
        enableAnalysisTimelineViewOverlay) {
        return (React.createElement("div", { className: "uifw-view-overlay" },
            React.createElement("div", { className: "uifw-animation-overlay" },
                React.createElement(TimelineComponent, { startDate: analysisAnimationTimelineDataProvider.start, endDate: analysisAnimationTimelineDataProvider.end, initialDuration: analysisAnimationTimelineDataProvider.initialDuration, totalDuration: analysisAnimationTimelineDataProvider.duration, 
                    // eslint-disable-next-line @typescript-eslint/no-deprecated
                    minimized: true, onChange: analysisAnimationTimelineDataProvider.onAnimationFractionChanged, onPlayPause: onPlayPause }))));
    }
    const enableScheduleAnimationViewOverlay = props.scheduleAnimation ??
        featureOptions?.defaultViewOverlay?.enableScheduleAnimationViewOverlay;
    if (scheduleTimelineDataProvider && enableScheduleAnimationViewOverlay) {
        return (React.createElement("div", { className: "uifw-view-overlay" },
            React.createElement("div", { className: "uifw-animation-overlay" },
                React.createElement(TimelineComponent, { startDate: scheduleTimelineDataProvider.start, endDate: scheduleTimelineDataProvider.end, initialDuration: scheduleTimelineDataProvider.initialDuration, totalDuration: scheduleTimelineDataProvider.duration, 
                    // eslint-disable-next-line @typescript-eslint/no-deprecated
                    minimized: true, onChange: scheduleTimelineDataProvider.onAnimationFractionChanged, onPlayPause: onPlayPause }))));
    }
    return null;
}
//# sourceMappingURL=DefaultViewOverlay.js.map