using System.Xml.Serialization;
using NewRock.Sdk.Control.Request.Base;

namespace NewRock.Sdk.Control.Response
{
    [XmlRoot(ElementName = "DeviceInfo")]
    public class QueryDeviceInfoResponse : NewRockResponse
    {
        /*
         * <?xml version="1.0" encoding="utf-8" ?>
<DeviceInfo>
  <manufacturer>New Rock Technologies, Inc</manufacturer>
  <model>Rev 7.0.1 OM20G-2S/2</model>
  <version>Rev 2.1.5.197</version>
  <mac>00:0E:A9:00:12:BD </mac>
  <devices>
    <ext lineid="Phone 1" id="200" />
    <ext lineid="Phone 2" id="201" />
    <ext lineid="IPPhone 13" id="208" />
    <ext lineid="IPPhone 14" id="206" />
    <ext lineid="IPPhone 15" id="204" />
    <ext lineid="IPPhone 16" id="205" />
    <ext lineid="IPPhone 17" id="207" />
    <ext lineid="IPPhone 18" id="209" />
    <ext lineid="IPPhone 19" id="210" />
    <ext lineid="IPPhone 20" id="211" />
    <line lineid="Line 3" id="202" />
    <line lineid="Line 4" id="203" />
  </devices>
</DeviceInfo>
         */

        [XmlElement("manufacturer")]
        public string Manufacturer { get; set; }

        
        [XmlElement("model")]
        public string Model { get; set; }

        
        [XmlElement("version")]
        public string Version { get; set; }

        [XmlElement("mac")]
        public string Mac { get; set; }

        [XmlElement("devices")]
        public DeviceInfoDevices Devices { get; set; }

        //[XmlAnyElement("devices")]
        //public Device[] Devices { get; set; }
    }

    public class DeviceInfoDevices
    {
        [XmlElement("ext")]
        public List<DevicesExt> Ext { get; set; }

        [XmlElement("line")]
        public List<DevicesLine> Line { get; set; }

        [XmlElement("group")]
        public List<DevicesGroup> Group { get; set; }
    }

    public class DevicesExt
    {
        [XmlAttribute("lineid")]
        public string LineId { get; set; }

        [XmlAttribute("id")]
        public string Id { get; set; }
    }

    public class DevicesLine
    {
        [XmlAttribute("lineid")]
        public string LineId { get; set; }

        [XmlAttribute("id")]
        public string Id { get; set; }
    }

    public class DevicesGroup
    {
        [XmlAttribute("id")]
        public string Id { get; set; }

        [XmlElement("ext")]
        public List<DevicesGroupExt> Ext { get; set; }
    }

    public class DevicesGroupExt
    {
        [XmlAttribute("id")]
        public string Id { get; set; }
    }
}
