using System;
using System.Collections.Generic;
using System.Reflection;
using System.Xml;
using JWH;

namespace JWH.TIB
{

    public class MessageValue
    {

        public string Name { get; set; } = string.Empty;

        public string Value { get; set; } = string.Empty;

        public string Format { get; set; } = string.Empty;

        public List<string> Values { get; set; } = new List<string>();

        public MethodInfo Method { get; set; } = null;

        public List<string> Parameters { get; set; } = new List<string>();

        public MessageValue()
        {
        }

        public MessageValue(XmlNode node)
        {
            try
            {
                node.PropertiesCopyAttribute(this);
                this.Value = node.InnerText;
            }
            catch (Exception ex)
            {
                XLogger.Instance.Fatal(ex);
            }
        }

        public override string ToString()
        {
            return $"{this.Name}={this.Value}";
        }

    }

}
