using Foresight;
using Foresight.Data;
using Foresight.Fleet.Services.FITracker;

namespace IronIntel.Contractor.FITracker
{
    public class FITrackerManagement
    {
        public static MobileDeviceInfo[] GetTrackerDevices(string sessionid, string searchtext)
        {
            TrackerClient client = FleetServiceClientHelper.CreateClient<TrackerClient>(sessionid);
            return client.GetMobileDevices(SystemParams.CompanyID);
        }

        public static ChatMessageInfo[] GetMessages(string sessionid, string deviceid, long lastmsgid)
        {
            TrackerClient client = FleetServiceClientHelper.CreateClient<TrackerClient>(sessionid);
            return client.GetChatMessages(deviceid, SystemParams.CompanyID, lastmsgid);
        }
        public static ChatMessageInfo PostMessage(string sessionid, string deviceid, string senderiid, string sendername, string msg, int type)
        {
            TrackerClient client = FleetServiceClientHelper.CreateClient<TrackerClient>(sessionid);
            return client.PostChatMessage(deviceid, senderiid, sendername, msg, type);
        }
        public static void ChangeAcceptableAccuracy(string sessionid, string deviceid, double accuracy, string note, string userid)
        {
            TrackerClient client = FleetServiceClientHelper.CreateClient<TrackerClient>(sessionid);
            client.ChangeAcceptableAccuracy(deviceid, accuracy, note, userid);
        }
    }
}
