using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Media;
using RainmeterStudio.Core.Documents;
using RainmeterStudio.UI.Controller;
namespace RainmeterStudio.UI.ViewModel
{
    public class DocumentTemplateViewModel
    {
        /// 
        /// Gets the document template
        /// 
        public DocumentTemplate Template { get; private set; }
        /// 
        /// Gets the document template name
        /// 
        public string Name { get { return Template.Name; } }
        #region Icon property
        private ImageSource _icon = null;
        /// 
        /// Gets or sets the icon of this document template
        /// 
        public virtual ImageSource Icon
        {
            get
            {
                if (_icon == null)
                    return IconProvider.GetIcon("Template_" + Name);
                return _icon;
            }
            set
            {
                _icon = value;
            }
        }
        #endregion
        #region Display text property
        private string _displayText = null;
        /// 
        /// Gets or sets the display text
        /// 
        public string DisplayText
        {
            get
            {
                if (_displayText == null)
                    return Resources.Strings.ResourceManager.GetString("Template_" + Name + "_DisplayText");
                return _displayText;
            }
            set
            {
                _displayText = value;
            }
        }
        #endregion
        #region Description property
        private string _description = null;
        /// 
        /// Gets or sets the description of this document template
        /// 
        public string Description
        {
            get
            {
                if (_description == null)
                    return Resources.Strings.ResourceManager.GetString("Template_" + Name + "_Description");
                return _description;
            }
            set
            {
                _description = value;
            }
        }
        #endregion
        #region Category property
        private string _category = null;
        /// 
        /// Gets or sets the category of this template
        /// 
        public string Category
        {
            get
            {
                if (_category == null)
                    return Resources.Strings.ResourceManager.GetString("Template_" + Name + "_Category");
                return _category;
            }
            set
            {
                _category = value;
            }
        }
        #endregion
        /// 
        /// Initializes the document template view model
        /// 
        /// The document template
        public DocumentTemplateViewModel(DocumentTemplate template)
        {
            this.Template = template;
        }
    }
}