using Device;
using ServiceBase;

namespace EEMSUIClientCore;

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

    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);
    }
}
