using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Tgstation.Server.Api.Models.Internal;
using Tgstation.Server.Host.Components.Interop;
using Tgstation.Server.Host.Models;
namespace Tgstation.Server.Host.Components.Chat.Providers
{
///
/// For interacting with a chat service.
///
interface IProvider : IAsyncDisposable
{
///
/// If the is currently connected.
///
bool Connected { get; }
///
/// If the was disposed.
///
bool Disposed { get; }
///
/// The that indicates the was mentioned.
///
string BotMention { get; }
///
/// A that completes once the finishes it's first connection attempt regardless of success.
///
Task InitialConnectionJob { get; }
///
/// Indicate to the provider that at least one call has successfully completed.
///
void InitialMappingComplete();
///
/// Get a resulting in the next the receives or on a disconnect.
///
/// The for the operation.
/// A resulting in the next available or if the needed to reconnect.
/// Note that private messages will come in the form of s not returned in .
Task NextMessage(CancellationToken cancellationToken);
///
/// Gracefully disconnects the provider. Permanently stops the reconnection timer.
///
/// The for the operation.
/// A representing the running operation.
ValueTask Disconnect(CancellationToken cancellationToken);
///
/// Get the s for given .
///
/// The s to map.
/// The for the operation.
/// A resulting in a of the 's s representing .
ValueTask>> MapChannels(IEnumerable channels, CancellationToken cancellationToken);
///
/// Send a message to the .
///
/// The optional to reply to.
/// The .
/// The to send to.
/// The for the operation.
/// A representing the running operation.
ValueTask SendMessage(Message? replyTo, MessageContent message, ulong channelId, CancellationToken cancellationToken);
///
/// Set the interval at which the provider starts jobs to try to reconnect.
///
/// The reconnection interval in minutes.
/// If a connection attempt should be made now.
/// A representing the running operation.
Task SetReconnectInterval(uint reconnectInterval, bool connectNow);
///
/// Send the message for a deployment.
///
/// The of the deployment.
/// The of the previous deployment if any.
/// The of the deployment.
/// The optional the deployment is expected to be completed at.
/// The repository GitHub owner, if any.
/// The repository GitHub name, if any.
/// The to send to.
/// if the local deployment commit was pushed to the remote repository.
/// The for the operation.
/// A resulting in a to call to update the message at the deployment's conclusion. Parameters: Error message if any, DreamMaker output if any. Returns another callback which should be called to mark the deployment as active.
ValueTask>>> SendUpdateMessage(
Models.RevisionInformation revisionInformation,
Models.RevisionInformation? previousRevisionInformation,
Api.Models.EngineVersion engineVersion,
DateTimeOffset? estimatedCompletionTime,
string? gitHubOwner,
string? gitHubRepo,
ulong channelId,
bool localCommitPushed,
CancellationToken cancellationToken);
}
}