using Device;
using ServiceBase;

namespace EEMSUIClientCore;

public class UICaller : IUICaller
{
    Task<bool> IUICaller.UpdateDeviceInfo(DeviceInfo deviceInfo)
    {
        HubBase.Invoke<bool, DeviceInfo>("UpdateDeviceInfo", deviceInfo, out bool Success);
        //return HubBase.Send("UpdateDeviceInfo", deviceInfo);
        return Task.FromResult(Success);
    }

    Task<IEnumerable<DeviceInfo>> IUICaller.RequestDeviceLists()
    {
        HubBase.Invoke("RequestDeviceLists", out IEnumerable<DeviceInfo>? device);
        if (device is null)
            return Task.FromResult(Enumerable.Empty<DeviceInfo>());

        return Task.FromResult(device);
    }

    Task<bool> IUICaller.RemoveDevice(Guid guid)
    {
        return HubBase.Send("RemoveDevice", guid);
    }
}
