using RobotLib.Communication;
using System;
using System.Collections.Generic;
using System.Text.Json;

namespace RobotLib.Movement
{
    public class DevLineSensor : DevBase
    {
        private const string TOPIC_ROBO_CALIB_CMD = "/mobile/cmd/line_sens/calib";
        private const string TOPIC_ROBO_GET_CALIB = "/mobile/cmd/line_sens/get_calib";
        private const string TOPIC_ROBO_CALIB_STATE = "/mobile/state/line_sens/calib_data";

        public DevLineSensor(IPublisherSubscriber com) : base(com, new List<string>() { }) { }

        public void GetCalibrationData()
        {
            base.SendMessage(TOPIC_ROBO_GET_CALIB, true.ToString());
        }

        public void StartCalibration(bool start)
        {
            string payload = JsonSerializer.Serialize(new Dictionary<string, bool>() { { "start", start } });
            base.SendMessage(TOPIC_ROBO_CALIB_CMD, payload);
        }
    }
}
