using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Artemis.Core;
using Artemis.UI.Shared.Services.Interfaces;
using DynamicData;
namespace Artemis.UI.Shared.Services.ProfileEditor;
///
/// Provides access the the profile editor back-end logic.
///
public interface IProfileEditorService : IArtemisSharedUIService
{
///
/// Gets an observable of the currently selected profile configuration.
///
IObservable ProfileConfiguration { get; }
///
/// Gets an observable of the currently selected profile element.
///
IObservable ProfileElement { get; }
///
/// Gets an observable of the current editor history.
///
IObservable History { get; }
///
/// Gets an observable of the profile preview playback time.
///
IObservable Time { get; }
///
/// Gets an observable of the profile preview playing state.
///
IObservable Playing { get; }
///
/// Gets an observable of the zoom level.
///
IObservable PixelsPerSecond { get; }
///
/// Connect to the observable list of keyframes and observe any changes starting with the list's initial items.
///
/// An observable which emits the change set.
IObservable> ConnectToKeyframes();
///
/// Changes the selected profile by its .
///
/// The profile configuration of the profile to select.
void ChangeCurrentProfileConfiguration(ProfileConfiguration? profileConfiguration);
///
/// Changes the selected profile element.
///
/// The profile element to select.
void ChangeCurrentProfileElement(RenderProfileElement? renderProfileElement);
///
/// Changes the current profile preview playback time.
///
/// The new time.
void ChangeTime(TimeSpan time);
///
/// Changes the current pixels per second
///
/// The new pixels per second.
void ChangePixelsPerSecond(int pixelsPerSecond);
///
/// Selects the provided keyframe.
///
/// The keyframe to select.
///
/// If expands the current selection; otherwise replaces it with only the
/// provided .
///
///
/// If toggles the selection and only for the provided
/// .
///
void SelectKeyframe(ILayerPropertyKeyframe? keyframe, bool expand, bool toggle);
///
/// Selects the provided keyframes.
///
/// The keyframes to select.
///
/// If expands the current selection; otherwise replaces it with only the
/// provided .
///
void SelectKeyframes(IEnumerable keyframes, bool expand);
///
/// Snaps the given time to the closest relevant element in the timeline, this can be the cursor, a keyframe or a
/// segment end.
///
/// The time to snap.
/// How close the time must be to snap.
/// Enable snapping to timeline segments.
/// Enable snapping to the current time of the editor.
/// An optional extra list of times to snap to.
/// The snapped time.
TimeSpan SnapToTimeline(TimeSpan time, TimeSpan tolerance, bool snapToSegments, bool snapToCurrentTime, List? snapTimes = null);
///
/// Rounds the given time to something appropriate for the current zoom level.
///
/// The time to round
/// The rounded time.
TimeSpan RoundTime(TimeSpan time);
///
/// Executes the provided command and adds it to the history.
///
/// The command to execute.
void ExecuteCommand(IProfileEditorCommand command);
///
/// Creates a new command scope which can be used to group undo/redo actions of multiple commands.
///
/// The name of the command scope.
/// The command scope that will group any commands until disposed.
ProfileEditorCommandScope CreateCommandScope(string name);
///
/// Saves the current profile.
///
void SaveProfile();
///
/// Asynchronously saves the current profile.
///
/// A task representing the save action.
Task SaveProfileAsync();
///
/// Resumes profile preview playback.
///
void Play();
///
/// Pauses profile preview playback.
///
void Pause();
}