using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using RainmeterStudio.Core.Model;
namespace RainmeterStudio.Core.Storage
{
    /// 
    /// Represents a reference that can be serialized
    /// 
    public class SerializableReference
    {
        /// 
        /// Gets or sets the name of the reference
        /// 
        [XmlElement("name")]
        public string Name
        {
            get
            {
                if (Reference != null)
                    return Reference.Name;
                return null;
            }
            set
            {
                Reference = new Reference(value, Path);
            }
        }
        /// 
        /// Gets or sets the path of the reference
        /// 
        [XmlElement("path")]
        public string Path
        {
            get
            {
                if (Reference != null)
                    return Reference.Path;
                return null;
            }
            set
            {
                Reference = new Reference(Name, value);
            }
        }
        /// 
        /// Gets or sets the (immutable) reference
        /// 
        [XmlIgnore]
        public Reference Reference
        {
            get;
            set;
        }
        /// 
        /// Initializes this serializable reference
        /// 
        public SerializableReference()
        {
        }
        public SerializableReference(Reference reference)
        {
            Reference = reference;
        }
    }
}