using System.Collections.ObjectModel;
using System.Security.Cryptography.X509Certificates;
using InABox.Core;

namespace InABox.Avalonia.Platform;

public interface IBluetoothDevice : IDisposable
{
     String ID { get; }
     
     String Name { get; }

     Guid[] AvailableServices { get; }
     
     DateTime LastSeen { get; set; }
}

public interface IConnectedBluetoothDevice : IBluetoothDevice
{

     Task<bool> WriteBytesAsync(Guid serviceid, Guid characteristicid, byte[] data);
     
     Task<bool> WriteStringAsync(Guid serviceid, Guid characteristicid, string data);
     
     Task<byte[]?> ReadBytesAsync(Guid serviceid, Guid characteristicid);
     
     Task<string?> ReadStringAsync(Guid serviceid, Guid characteristicid);
}

public interface IBluetooth : ILoggable
{
     Logger? Logger { get; set; }

     Task<bool> IsAvailable();

     //Task<IBluetoothDevice?> FindDevice(Guid serviceId, TimeSpan timeout);
     
     Task<bool> StartScanningAsync(Guid configServiceId);
     
     Task<bool> StopScanningAsync();
     
     Task<IConnectedBluetoothDevice?> Connect(IBluetoothDevice deviceid);
     
     Task<bool> Disconnect(IConnectedBluetoothDevice device);

     event EventHandler? Changed;
     
     CoreObservableCollection<IBluetoothDevice> Devices { get; }
     
}
