// Copyright (c) Arlo Godfrey. All Rights Reserved.
// Licensed under the GNU Lesser General Public License, Version 3.0 with additional terms.
// See the LICENSE, LICENSE.LESSER and LICENSE.ADDITIONAL files in the project root for more information.
using System.Collections.ObjectModel;
using System.Threading;
using System.Threading.Tasks;
using CommunityToolkit.Mvvm.Input;
using OwlCore.Provisos;
using StrixMusic.Sdk.AppModels;
using StrixMusic.Sdk.BaseModels;
namespace StrixMusic.Sdk.ViewModels
{
///
/// An interfaced ViewModel for .
/// This is needed so because multiple view models implement ,
/// and the UI needs to create controls that handle only the ViewModels properties for an .
///
public interface ITrackCollectionViewModel : ISdkViewModel, ITrackCollection, IAsyncInit
{
///
/// The tracks in this collection.
///
public ObservableCollection Tracks { get; }
///
/// Keeps the default track collection while sorting.
///
public ObservableCollection UnsortedTracks { get; }
///
/// Populates the next set of tracks into the collection.
///
/// The number of items to load.
/// A cancellation token that may be used to cancel the ongoing task.
/// A representing the asynchronous operation.
public Task PopulateMoreTracksAsync(int limit, CancellationToken cancellationToken = default);
///
/// The current sorting type of tracks in the collection.
///
public TrackSortingType CurrentTracksSortingType { get; }
///
/// The current sorting direction of tracks in the collection.
///
public SortDirection CurrentTracksSortingDirection { get; }
///
/// Sorts the track collection by .
///
/// The by which to sort.
/// The direction by which to sort.
public void SortTrackCollection(TrackSortingType trackSorting, SortDirection sortDirection);
///
/// Loads the entire collection of s and ensures all sources are merged.
///
/// A representing the asynchronous operation.
public Task InitTrackCollectionAsync(CancellationToken cancellationToken = default);
///
/// Initializes the list of the .
///
public IAsyncRelayCommand InitTrackCollectionAsyncCommand { get; }
///
public IAsyncRelayCommand PopulateMoreTracksCommand { get; }
///
public IAsyncRelayCommand PlayTrackCollectionAsyncCommand { get; }
///
/// Plays a single track from this track collection.
///
public IAsyncRelayCommand PlayTrackAsyncCommand { get; }
///
public IAsyncRelayCommand PauseTrackCollectionAsyncCommand { get; }
///
/// Sorts the collection with a new type.
///
public IRelayCommand ChangeTrackCollectionSortingTypeCommand { get; }
///
/// Sorts the collection with a new direction.
///
public IRelayCommand ChangeTrackCollectionSortingDirectionCommand { get; }
}
}