using System;
using System.Windows;

namespace Earthblend.Tts.Common.Core.Behaviors
{
    public class ObjectBinder
    {
        #region Private Constants

        private const String DataItemPropertyName = "DataItem";
        private const String TagPropertyName = "Tag";

        #endregion

        #region Private Default Value Constants

        private const Object DataItemPropertyDefaultValue = null;
        private const Object TagPropertyDefaultValue = null;

        #endregion

        #region Public Dependency Properties

        public static readonly DependencyProperty DataItemProperty = DependencyProperty.RegisterAttached(DataItemPropertyName, typeof(Object), typeof(ObjectBinder), new UIPropertyMetadata(DataItemPropertyDefaultValue));
        public static readonly DependencyProperty TagProperty = DependencyProperty.RegisterAttached(TagPropertyName, typeof(Object), typeof(ObjectBinder), new UIPropertyMetadata(TagPropertyDefaultValue));

        #endregion

        #region Accessors

        public static Object GetDataItem(DependencyObject obj)
        {
            return obj?.GetValue(DataItemProperty);
        }

        public static void SetDataItem(DependencyObject obj, Object value)
        {
            obj?.SetValue(DataItemProperty, value);
        }


        public static Object GetTag(DependencyObject obj)
        {
            return obj?.GetValue(TagProperty);
        }

        public static void SetTag(DependencyObject obj, Object value)
        {
            obj?.SetValue(TagProperty, value);
        }

        #endregion
    }
}
