// 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;
using System.Collections.Generic;
using System.Threading.Tasks;
using OwlCore.AbstractStorage;
using OwlCore.Provisos;
using StrixMusic.Sdk.FileMetadata.Models;
namespace StrixMusic.Sdk.FileMetadata.Repositories
{
///
/// A repository that provides access to metadata scanned from a file.
///
public interface IMetadataRepository : IAsyncInit, IDisposable
where TFileMetadata : class, IFileMetadata
{
///
/// Sets the root folder to operate in when saving data.
///
/// The root folder to save data in.
public void SetDataFolder(IFolderData rootFolder);
///
/// Returns the number of items currently loaded in the repository.
///
/// A representing the asynchronous operation.
public Task GetItemCount();
///
/// Adds a metadata to the repo, or updates an existing metadata.
///
/// The metadata to add.
/// A representing the asynchronous operation.
public Task AddOrUpdateAsync(params TFileMetadata[] metadata);
///
/// Removes metadata from the repository.
///
/// The metadata to remove.
/// A representing the asynchronous operation.
/// The specified does not exist in the repository.
public Task RemoveAsync(TFileMetadata metadata);
///
/// Gets metadata by the given .
///
/// The id of some metadata in the repository..
/// A representing the asynchronous operation. Value is the metadata if found, otherwise null.
public Task GetByIdAsync(string id);
///
/// Gets all over the file system.
///
/// The starting index for retrieving items.
/// The maximum number of items to return.
/// A representing the asynchronous operation.
public Task> GetItemsAsync(int offset, int limit);
///
/// Raised when metadata is updated.
///
public event EventHandler>? MetadataUpdated;
///
/// Raised metadata is removed.
///
public event EventHandler>? MetadataRemoved;
///
/// Raised when new metadata is added.
///
public event EventHandler>? MetadataAdded;
}
}