using MECF.Framework.Common.CommonData;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Schema;
using System.Xml.Serialization;

namespace MECF.Framework.Common.Device.LinMot
{
    public class LinMotDevice : NotifiableItem
    {
        private string _name;
        private short _statusWord;
        private string _direction;
        private double _position;
        private int _scanCount;
        private string _parentName;
        private bool _isConnected;
        private int _speed;

        [XmlAttribute(AttributeName = "Name", Form = XmlSchemaForm.Unqualified, DataType = "string")]
        public string Name { get { return _name; } set { _name = value; InvokePropertyChanged(nameof(Name)); } }

        public string ParentName { get { return _parentName; } set { _parentName = value; InvokePropertyChanged(nameof(ParentName)); } }


        [XmlAttribute(AttributeName = "Address", Form = XmlSchemaForm.Unqualified, DataType = "string")]
        public string Address { get; set; }

        [XmlAttribute(AttributeName = "NoProfile", Form = XmlSchemaForm.Unqualified, DataType = "string")]
        public string NoProfile { get; set; }

        [XmlAttribute(AttributeName = "Drive_A_Mode", Form = XmlSchemaForm.Unqualified, DataType = "string")]
        public string Drive_A_Mode { get; set; }
        [XmlAttribute(AttributeName = "Drive_B_Mode", Form = XmlSchemaForm.Unqualified, DataType = "string")]
        public string Drive_B_Mode { get; set; }
        [XmlAttribute(AttributeName = "ModuleName", Form = XmlSchemaForm.Unqualified, DataType = "string")]
        public string ModuleName { get; set; }
        [XmlAttribute(AttributeName = "ModuleSettingMode", Form = XmlSchemaForm.Unqualified, DataType = "string")]
        public string ModuleSettingMode { get; set; }
        [XmlAttribute(AttributeName = "ModuleAddress", Form = XmlSchemaForm.Unqualified, DataType = "string")]
        public string ModuleAddress { get; set; }

        [XmlElement(Type = typeof(LinMotDeviceData), ElementName = "DeviceData", IsNullable = false, Form = XmlSchemaForm.Qualified)]
        public LinMotDeviceData LinMotDeviceData { get; set; }

        public short StatusWord { get { return _statusWord; } set { _statusWord = value; InvokePropertyChanged(nameof(StatusWord)); } }

        public string Direction { get { return _direction; } set { _direction = value; InvokePropertyChanged(nameof(Direction)); } }

        public double Position { get { return _position; } set { _position = value;InvokePropertyChanged(nameof(Position)); } }

        public int ScanCount { get { return _scanCount; } set {_scanCount = value; InvokePropertyChanged(nameof(ScanCount)); } }

        public bool IsConnected { get { return _isConnected; } set { _isConnected = value; InvokePropertyChanged(nameof(IsConnected)); } }

        public int Speed { get { return _speed; } set { _speed = value;InvokePropertyChanged(nameof(Speed)); } }
    }
}