//
// TakeControlCommand.cs
//
// Copyright (c) František Boháček. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Threading;
using System.Threading.Tasks;
using Remora.Results;
namespace NosSmooth.Core.Commands.Control;
///
/// Take control in the given group and call the given callback with a cancellation token.
///
///
/// The command will be cancelled either if the program tries to take control in the same group again
/// or the user has clicked somewhere to cancel the operation.
///
/// The callback to be called when control is granted.
/// The callback to be called if the operation was cancelled and the control was revoked.
/// The group of the take control.
/// Whether the command may be cancelled by another task within the same group.
/// Whether to wait for finish of the previous task
/// Whether to allow the user to cancel by taking any walk/focus/unfollow action
/// Whether the command should be cancelled on map change.
public record TakeControlCommand
(
Func> HandleCallback,
Func> CancelledCallback,
string Group = "__default",
bool CanBeCancelledByAnother = true,
bool WaitForCancellation = true,
bool AllowUserCancel = true,
bool CancelOnMapChange = true
) : ITakeControlCommand;