//
// Copyright (c) slskd Team. All rights reserved.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see https://www.gnu.org/licenses/.
//
using System.IO;
namespace slskd.Shares
{
using System.Collections.Generic;
using System.Threading.Tasks;
using Soulseek;
///
/// Provides control and interactions with configured shares and shared files.
///
public interface IShareService
{
///
/// Gets the list of share hosts.
///
IReadOnlyList Hosts { get; }
///
/// Gets the state monitor for the service.
///
public IStateMonitor StateMonitor { get; }
///
/// Returns the entire contents of the share.
///
/// The entire contents of the share.
Task> BrowseAsync(Share share = null);
///
/// Returns the contents of the specified .
///
/// The directory for which the contents are to be listed.
/// The contents of the directory.
Task ListDirectoryAsync(string directory);
///
/// Resolves the local filename of the specified , if the mask is associated with a
/// configured share.
///
/// The fully qualified filename to resolve.
/// The resolved local filename.
///
/// Thrown when the specified remote filename can not be associated with a configured share.
///
Task ResolveFileAsync(string remoteFilename);
///
/// Searches the cache for the specified and returns the matching files.
///
/// The query for which to search.
/// The matching files.
Task> SearchAsync(SearchQuery query);
///
/// Scans the configured shares on the local host.
///
/// The operation context.
/// Thrown when a scan is already in progress.
Task ScanAsync();
///
/// Gets summary information for the specified .
///
/// The share to summarize.
/// The summary information.
Task<(int Directories, int Files)> SummarizeShareAsync(Share share);
///
/// Cancels the currently running scan on the local host, if one is running.
///
/// A value indicating whether a scan was cancelled.
bool TryCancelScan();
///
/// Initializes the service and shares.
///
/// A value indicating whether a full re-scan of shares should be performed.
/// The operation context.
Task InitializeAsync(bool forceRescan = false);
}
}