using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using OwlCore.Events; using OwlCore.Provisos; using StrixMusic.Sdk.CoreModels; using StrixMusic.Sdk.MediaPlayback; namespace StrixMusic.Cores.Files.Models { /// public abstract class FilesCorePlayableCollectionGroupBase : ICorePlayableCollectionGroup, IAsyncInit { private int _totalAlbumItemsCount; private int _totalArtistItemsCount; private int _totalTrackCount; private int _totalPlaylistItemsCount; private int _totalChildrenCount; /// /// Initializes a new instance of the class. /// /// The instance of the core this object was created in. protected FilesCorePlayableCollectionGroupBase(ICore sourceCore) { SourceCore = sourceCore; } /// /// Initializes the collection group base. /// /// A representing the asynchronous operation. public virtual Task InitAsync(CancellationToken cancellationToken = default) { IsInitialized = true; return Task.CompletedTask; } /// public event EventHandler? PlaybackStateChanged; /// public event EventHandler? NameChanged; /// public event EventHandler? DescriptionChanged; /// public event EventHandler? DurationChanged; /// public event EventHandler? LastPlayedChanged; /// public event EventHandler? IsPlayAlbumCollectionAsyncAvailableChanged; /// public event EventHandler? IsPauseAlbumCollectionAsyncAvailableChanged; /// public event EventHandler? IsPlayArtistCollectionAsyncAvailableChanged; /// public event EventHandler? IsPauseArtistCollectionAsyncAvailableChanged; /// public event EventHandler? IsPlayPlaylistCollectionAsyncAvailableChanged; /// public event EventHandler? IsPausePlaylistCollectionAsyncAvailableChanged; /// public event EventHandler? IsPlayTrackCollectionAsyncAvailableChanged; /// public event EventHandler? IsPauseTrackCollectionAsyncAvailableChanged; /// public event EventHandler? IsChangeNameAsyncAvailableChanged; /// public event EventHandler? IsChangeDescriptionAsyncAvailableChanged; /// public event EventHandler? IsChangeDurationAsyncAvailableChanged; /// ? public virtual event EventHandler? AlbumItemsCountChanged; /// ? public virtual event EventHandler? ArtistItemsCountChanged; /// ? public virtual event EventHandler? PlaylistItemsCountChanged; /// ? public virtual event EventHandler? TracksCountChanged; /// ? public virtual event EventHandler? ChildrenCountChanged; /// public virtual event EventHandler? ImagesCountChanged; /// public virtual event EventHandler? UrlsCountChanged; /// ? public virtual event CollectionChangedEventHandler? PlaylistItemsChanged; /// ? public virtual event CollectionChangedEventHandler? TracksChanged; /// ? public virtual event CollectionChangedEventHandler? AlbumItemsChanged; /// ? public virtual event CollectionChangedEventHandler? ArtistItemsChanged; /// ? public virtual event CollectionChangedEventHandler? ChildItemsChanged; /// ? public virtual event CollectionChangedEventHandler? ImagesChanged; /// ? public virtual event CollectionChangedEventHandler? UrlsChanged; /// public ICore SourceCore { get; private set; } /// public abstract string Id { get; protected set; } /// public abstract string Name { get; protected set; } /// public abstract string? Description { get; protected set; } /// public PlaybackState PlaybackState => PlaybackState.None; /// public TimeSpan Duration => TimeSpan.Zero; /// public DateTime? LastPlayed { get; } /// public DateTime? AddedAt { get; } /// public virtual int TotalAlbumItemsCount { get => _totalAlbumItemsCount; internal set { _totalAlbumItemsCount = value; AlbumItemsCountChanged?.Invoke(this, value); } } /// public virtual int TotalArtistItemsCount { get => _totalArtistItemsCount; internal set { _totalArtistItemsCount = value; ArtistItemsCountChanged?.Invoke(this, value); } } /// public virtual int TotalTrackCount { get => _totalTrackCount; internal set { _totalTrackCount = value; TracksCountChanged?.Invoke(this, value); } } /// public virtual int TotalPlaylistItemsCount { get => _totalPlaylistItemsCount; internal set { _totalPlaylistItemsCount = value; PlaylistItemsCountChanged?.Invoke(this, value); } } /// public virtual int TotalChildrenCount { get => _totalChildrenCount; internal set { _totalChildrenCount = value; ChildrenCountChanged?.Invoke(this, value); } } /// public int TotalImageCount { get; } = 0; /// public int TotalUrlCount { get; } = 0; /// public bool IsPlayAlbumCollectionAsyncAvailable => false; /// public bool IsPauseAlbumCollectionAsyncAvailable => false; /// public bool IsPlayArtistCollectionAsyncAvailable => false; /// public bool IsPauseArtistCollectionAsyncAvailable => false; /// public bool IsPlayPlaylistCollectionAsyncAvailable => false; /// public bool IsPausePlaylistCollectionAsyncAvailable => false; /// public bool IsPlayTrackCollectionAsyncAvailable => false; /// public bool IsPauseTrackCollectionAsyncAvailable => false; /// public bool IsChangeNameAsyncAvailable => true; /// public bool IsChangeDescriptionAsyncAvailable => true; /// public bool IsChangeDurationAsyncAvailable => true; /// public virtual bool IsInitialized { get; protected set; } /// public Task IsAddChildAvailableAsync(int index, CancellationToken cancellationToken = default) { return Task.FromResult(false); } /// public Task IsAddPlaylistItemAvailableAsync(int index, CancellationToken cancellationToken = default) { return Task.FromResult(false); } /// public Task IsAddTrackAvailableAsync(int index, CancellationToken cancellationToken = default) { return Task.FromResult(false); } /// public Task IsAddArtistItemAvailableAsync(int index, CancellationToken cancellationToken = default) { return Task.FromResult(false); } /// public Task IsAddAlbumItemAvailableAsync(int index, CancellationToken cancellationToken = default) { return Task.FromResult(false); } /// public Task IsAddImageAvailableAsync(int index, CancellationToken cancellationToken = default) { return Task.FromResult(false); } /// public Task IsAddUrlAvailableAsync(int index, CancellationToken cancellationToken = default) { return Task.FromResult(false); } /// public Task IsRemoveTrackAvailableAsync(int index, CancellationToken cancellationToken = default) { return Task.FromResult(false); } /// public Task IsRemoveImageAvailableAsync(int index, CancellationToken cancellationToken = default) { return Task.FromResult(false); } /// public Task IsRemoveUrlAvailableAsync(int index, CancellationToken cancellationToken = default) { return Task.FromResult(false); } /// public Task IsRemovePlaylistItemAvailableAsync(int index, CancellationToken cancellationToken) { return Task.FromResult(false); } /// public Task IsRemoveAlbumItemAvailableAsync(int index, CancellationToken cancellationToken = default) { return Task.FromResult(false); } /// public Task IsRemoveArtistItemAvailableAsync(int index, CancellationToken cancellationToken = default) { return Task.FromResult(false); } /// public Task IsRemoveChildAvailableAsync(int index, CancellationToken cancellationToken = default) { return Task.FromResult(false); } /// public Task ChangeDescriptionAsync(string? description, CancellationToken cancellationToken = default) { throw new NotSupportedException(); } /// public Task ChangeDurationAsync(TimeSpan duration, CancellationToken cancellationToken = default) { throw new NotSupportedException(); } /// public Task ChangeNameAsync(string name, CancellationToken cancellationToken = default) { throw new NotSupportedException(); } /// A cancellation token that may be used to cancel the ongoing task. /// public Task PauseAlbumCollectionAsync(CancellationToken cancellationToken = default) { throw new NotSupportedException(); } /// A cancellation token that may be used to cancel the ongoing task. /// public Task PlayAlbumCollectionAsync(CancellationToken cancellationToken = default) { throw new NotSupportedException(); } /// A cancellation token that may be used to cancel the ongoing task. /// public Task PauseArtistCollectionAsync(CancellationToken cancellationToken = default) { throw new NotSupportedException(); } /// A cancellation token that may be used to cancel the ongoing task. /// public Task PlayArtistCollectionAsync(CancellationToken cancellationToken = default) { throw new NotSupportedException(); } /// A cancellation token that may be used to cancel the ongoing task. /// public Task PausePlaylistCollectionAsync(CancellationToken cancellationToken = default) { throw new NotSupportedException(); } /// A cancellation token that may be used to cancel the ongoing task. /// public Task PlayPlaylistCollectionAsync(CancellationToken cancellationToken = default) { throw new NotSupportedException(); } /// A cancellation token that may be used to cancel the ongoing task. /// public Task PauseTrackCollectionAsync(CancellationToken cancellationToken = default) { throw new NotSupportedException(); } /// A cancellation token that may be used to cancel the ongoing task. /// public Task PlayTrackCollectionAsync(CancellationToken cancellationToken = default) { throw new NotSupportedException(); } /// public Task PlayAlbumCollectionAsync(ICoreAlbumCollectionItem albumItem, CancellationToken cancellationToken = default) { throw new NotSupportedException(); } /// A cancellation token that may be used to cancel the ongoing task. /// public Task PlayPlayableCollectionGroupAsync(CancellationToken cancellationToken = default) { throw new NotSupportedException(); } /// A cancellation token that may be used to cancel the ongoing task. /// public Task PausePlayableCollectionGroupAsync(CancellationToken cancellationToken = default) { throw new NotSupportedException(); } /// public Task PlayPlaylistCollectionAsync(ICorePlaylistCollectionItem playlistItem, CancellationToken cancellationToken = default) { throw new NotSupportedException(); } /// public Task PlayArtistCollectionAsync(ICoreArtistCollectionItem artistItem, CancellationToken cancellationToken = default) { throw new NotSupportedException(); } /// public Task PlayPlayableCollectionGroupAsync(ICorePlayableCollectionGroup collectionGroup, CancellationToken cancellationToken = default) { throw new NotSupportedException(); } /// public Task PlayTrackCollectionAsync(ICoreTrack track, CancellationToken cancellationToken = default) { throw new NotSupportedException(); } /// public abstract IAsyncEnumerable GetAlbumItemsAsync(int limit, int offset, CancellationToken cancellationToken = default); /// public abstract IAsyncEnumerable GetArtistItemsAsync(int limit, int offset, CancellationToken cancellationToken = default); /// public abstract IAsyncEnumerable GetChildrenAsync(int limit, int offset, CancellationToken cancellationToken = default); /// public abstract IAsyncEnumerable GetPlaylistItemsAsync(int limit, int offset, CancellationToken cancellationToken = default); /// public abstract IAsyncEnumerable GetTracksAsync(int limit, int offset, CancellationToken cancellationToken = default); /// public IAsyncEnumerable GetImagesAsync(int limit, int offset, CancellationToken cancellationToken = default) { throw new NotImplementedException(); } /// public abstract IAsyncEnumerable GetUrlsAsync(int limit, int offset, CancellationToken cancellationToken = default); /// public Task AddTrackAsync(ICoreTrack track, int index, CancellationToken cancellationToken = default) { throw new NotSupportedException(); } /// public Task AddArtistItemAsync(ICoreArtistCollectionItem artist, int index, CancellationToken cancellationToken = default) { throw new NotSupportedException(); } /// public Task AddAlbumItemAsync(ICoreAlbumCollectionItem album, int index, CancellationToken cancellationToken = default) { throw new NotSupportedException(); } /// public Task AddPlaylistItemAsync(ICorePlaylistCollectionItem playlist, int index, CancellationToken cancellationToken = default) { throw new NotSupportedException(); } /// public Task AddChildAsync(ICorePlayableCollectionGroup child, int index, CancellationToken cancellationToken = default) { throw new NotSupportedException(); } /// public Task AddImageAsync(ICoreImage image, int index, CancellationToken cancellationToken = default) { throw new NotSupportedException(); } /// public Task AddUrlAsync(ICoreUrl url, int index, CancellationToken cancellationToken = default) { throw new NotSupportedException(); } /// public Task RemoveTrackAsync(int index, CancellationToken cancellationToken = default) { throw new NotSupportedException(); } /// public Task RemoveArtistItemAsync(int index, CancellationToken cancellationToken = default) { throw new NotSupportedException(); } /// public Task RemoveAlbumItemAsync(int index, CancellationToken cancellationToken = default) { throw new NotSupportedException(); } /// public Task RemovePlaylistItemAsync(int index, CancellationToken cancellationToken = default) { throw new NotSupportedException(); } /// public Task RemoveChildAsync(int index, CancellationToken cancellationToken = default) { throw new NotSupportedException(); } /// public Task RemoveImageAsync(int index, CancellationToken cancellationToken = default) { throw new NotSupportedException(); } /// public Task RemoveUrlAsync(int index, CancellationToken cancellationToken = default) { throw new NotSupportedException(); } /// public virtual ValueTask DisposeAsync() { return default; } } }