// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace System.Linq
{
///
/// Represents a sorted async-enumerable sequence.
///
/// The type of the elements of the sequence.
public interface IOrderedAsyncEnumerable : IAsyncEnumerable
{
///
/// Performs a subsequent ordering on the elements of an ordered async-enumerable according to a key.
///
/// The type of the key produced by keySelector.
/// The function used to extract the key for each element.
/// The comparer used to compare keys for placement in the returned sequence.
/// true to sort the elements in descending order; false to sort the elements in ascending order.
/// An ordered async-enumerable whose elements are sorted according to a key.
IOrderedAsyncEnumerable CreateOrderedEnumerable(Func keySelector, IComparer? comparer, bool descending);
///
/// Performs a subsequent ordering on the elements of an ordered async-enumerable according to a key provided via a ValueTask.
///
/// The type of the key produced by keySelector.
/// The function used to extract the key for each element as a ValueTask.
/// The comparer used to compare keys for placement in the returned sequence.
/// true to sort the elements in descending order; false to sort the elements in ascending order.
/// An ordered async-enumerable whose elements are sorted according to a key.
IOrderedAsyncEnumerable CreateOrderedEnumerable(Func> keySelector, IComparer? comparer, bool descending);
#if !NO_DEEP_CANCELLATION
///
/// Performs a subsequent ordering on the elements of an ordered async-enumerable according to a key provided via a ValueTask.
///
/// The type of the key produced by keySelector.
/// The function used to extract the key for each element as a ValueTask supporting cancellation.
/// The comparer used to compare keys for placement in the returned sequence.
/// true to sort the elements in descending order; false to sort the elements in ascending order.
/// An ordered async-enumerable whose elements are sorted according to a key.
IOrderedAsyncEnumerable CreateOrderedEnumerable(Func> keySelector, IComparer? comparer, bool descending);
#endif
}
}