using System;
using System.Collections.Generic;
using System.Text;

namespace Vortex.Utils.Reflection {

	/// <summary>
	/// Implements common part for all of value proxies
	/// </summary>
	public abstract class AbstractValueProxy : IValueProxy {
		private object _instance;

		/// <summary>
		/// Initializes a new instance of the <see cref="AbstractValueProxy"/> class.
		/// </summary>
		/// <param name="instance">The target instance, may be null if property is static.</param>
		public AbstractValueProxy(object instance) {
			_instance = instance;
		}

		#region IValueAccessor Members

		/// <summary>
		/// Gets the target instance of this proxy.
		/// </summary>
		/// <value>The target instance of this proxy.</value>
		public object Instance {
			get { return _instance; }
		}

		/// <summary>
		/// Gets or sets the value of target instance.
		/// </summary>
		/// <value>The proxied value.</value>
		public abstract object Value { get; set; }

		/// <summary>
		/// Gets the name of proxied value accessor.
		/// </summary>
		/// <value>The name of proxied accessor.</value>
		public abstract string Name { get; }

		/// <summary>
		/// Gets the type of the value.
		/// </summary>
		/// <value>The type of the value.</value>
		public abstract Type ValueType { get; }

		#endregion
	}
}
