using System;
using System.Threading.Tasks;
using TINK.Services.BluetoothLock.Tdo;

namespace TINK.Services.BluetoothLock
{
    /// <summary>
    /// Represents a not exisitng lock.
    /// </summary>
    public class NullLock : ILockService
    {
        private int BikeId { get; }

        public NullLock(int bikeId)
        {
            BikeId = bikeId;
        }

        public Task ReconnectAsync(LockInfoAuthTdo authInfo, TimeSpan connectTimeout) =>
            throw new NotImplementedException();

        public string Name => 
            throw new NotImplementedException();

        public Guid Guid => 
            throw new NotImplementedException();

        public int Id => 
            throw new NotImplementedException();

        public async Task<LockitLockingState?> OpenAsync() =>
            await Task.FromResult((LockitLockingState?)null);

        public async Task<LockitLockingState?> CloseAsync() => 
            await Task.FromResult((LockitLockingState?)null);

        public Task<double> GetBatteryPercentageAsync() => 
            throw new System.Exception($"Can not get battery percentage. Lock {BikeId} not found.");

        public DeviceState? GetDeviceState() =>
            throw new NotImplementedException();

        public Task<bool> GetIsAlarmOffAsync() => 
            throw new System.Exception($"Can not get whether alarm is on or off. Lock {BikeId} not found.");

        public Task<LockInfoTdo> GetLockStateAsync(bool doWaitRetry = false) =>
            throw new NotImplementedException();

        public Task SetIsAlarmOffAsync(bool isActivated) => 
            throw new System.Exception($"Can not set alarm {isActivated}. Lock {BikeId} not found.");

        public async Task<bool> SetSoundAsync(SoundSettings settings) => 
            await Task.FromResult(false);

        /// <summary> Disconnect from bluetooth lock. </summary>
        public Task Disconnect() => 
            throw new NotImplementedException();

    }
}