using Serilog;
using System;
using System.Threading.Tasks;
using TINK.Model.Bike.BluetoothLock;
using TINK.Model.State;
namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
{
public class InvalidState : IRequestHandler
{
/// View model to be used for progress report and unlocking/ locking view.
public InvalidState(
IBikesViewModel bikesViewModel,
InUseStateEnum copriState,
LockingState lockingState,
string errorText)
{
BikesViewModel = bikesViewModel
?? throw new ArgumentException($"Can not construct {GetType().Name}-object. {nameof(bikesViewModel)} must not be null.");
State = copriState;
ErrorText = errorText;
Log.Error($"{errorText}. Copri state is {State} and lock state is {lockingState}.");
}
/// View model to be used for progress report and unlocking/ locking view.
public IBikesViewModel BikesViewModel { get; }
public bool IsLockitButtonVisible => false;
public string LockitButtonText => GetType().Name;
public bool IsConnected => false;
public InUseStateEnum State { get; }
private LockingState LockingState { get; }
public bool IsButtonVisible => false;
public string ButtonText => GetType().Name;
/// Gets if the bike has to be remvoed after action has been completed.
public bool IsRemoveBikeRequired => false;
public string ErrorText { get; }
public async Task HandleRequestOption2()
{
Log.ForContext().Error($"Click of unsupported button {nameof(HandleRequestOption2)} detected.");
return await Task.FromResult(this);
}
public async Task HandleRequestOption1()
{
Log.ForContext().Error($"Click of unsupported button {nameof(HandleRequestOption1)} detected.");
return await Task.FromResult(this);
}
}
}