using System.Text.Json.Serialization;

namespace OpenAuth.WebApi.Model.mqtt.ModelResponse
{
    public class HmsMessage
    {
        public string bid { get; set; }
        public string tid { get; set; }
         
        public long timestamp { get; set; }

        public string method { get; set; }
        public HmsData data { get; set; }
    }

    public class HmsData
    {
        public List<HmsItem> list { get; set; }
    }

    public class HmsItem
    {
        public string code { get; set; }
         
        public string device_type { get; set; }

        public int module { get; set; }
         
        public int component_index => args?.component_index ?? -1;

        [JsonPropertyName("sensor_index")]
        public int sensor_index => args?.sensor_index ?? -1;

        public int level { get; set; }
        public int imminent { get; set; }
        public int in_the_sky { get; set; }

        public HmsArgs args { get; set; }
    }

    public class HmsArgs
    { 
        public int component_index { get; set; }
         
        public int sensor_index { get; set; }
    }
}
