using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using SmartStore.Core.Domain.Localization;
using SmartStore.Core.Domain.Seo;
using SmartStore.Core.Domain.Stores;

namespace SmartStore.Core.Domain.Blogs
{
	/// <summary>
	/// Represents a blog post
	/// </summary>
	[DataContract]
	public partial class BlogPost : BaseEntity, ISlugSupported, IStoreMappingSupported
    {
        private ICollection<BlogComment> _blogComments;

		/// <summary>
		/// Gets or sets the language identifier
		/// </summary>
		[DataMember]
		public int LanguageId { get; set; }

		/// <summary>
		/// Gets or sets the blog post title
		/// </summary>
		[DataMember]
		public string Title { get; set; }

		/// <summary>
		/// Gets or sets the blog post title
		/// </summary>
		[DataMember]
		public string Body { get; set; }

		/// <summary>
		/// Gets or sets a value indicating whether the blog post comments are allowed 
		/// </summary>
		[DataMember]
		public bool AllowComments { get; set; }

		/// <summary>
		/// Gets or sets the total number of approved comments
		/// <remarks>The same as if we run newsItem.NewsComments.Where(n => n.IsApproved).Count()
		/// We use this property for performance optimization (no SQL command executed)
		/// </remarks>
		/// </summary>
		[DataMember]
		public int ApprovedCommentCount { get; set; }

		/// <summary>
		/// Gets or sets the total number of not approved comments
		/// <remarks>The same as if we run newsItem.NewsComments.Where(n => !n.IsApproved).Count()
		/// We use this property for performance optimization (no SQL command executed)</remarks>
		/// </summary>
		[DataMember]
		public int NotApprovedCommentCount { get; set; }

		/// <summary>
		/// Gets or sets the blog tags
		/// </summary>
		[DataMember]
		public string Tags { get; set; }

		/// <summary>
		/// Gets or sets the blog post start date and time
		/// </summary>
		[DataMember]
		public DateTime? StartDateUtc { get; set; }

		/// <summary>
		/// Gets or sets the blog post end date and time
		/// </summary>
		[DataMember]
		public DateTime? EndDateUtc { get; set; }

		/// <summary>
		/// Gets or sets the meta keywords
		/// </summary>
		[DataMember]
		public string MetaKeywords { get; set; }

		/// <summary>
		/// Gets or sets the meta description
		/// </summary>
		[DataMember]
		public string MetaDescription { get; set; }

		/// <summary>
		/// Gets or sets the meta title
		/// </summary>
		[DataMember]
		public string MetaTitle { get; set; }

		/// <summary>
		/// Gets or sets a value indicating whether the entity is limited/restricted to certain stores
		/// </summary>
		[DataMember]
		public bool LimitedToStores { get; set; }

		/// <summary>
		/// Gets or sets the date and time of entity creation
		/// </summary>
		[DataMember]
		public virtual DateTime CreatedOnUtc { get; set; }

		/// <summary>
		/// Gets or sets the blog comments
		/// </summary>
		[DataMember]
		public virtual ICollection<BlogComment> BlogComments
        {
			get { return _blogComments ?? (_blogComments = new HashSet<BlogComment>()); }
            protected set { _blogComments = value; }
        }

		/// <summary>
		/// Gets or sets the language
		/// </summary>
		[DataMember]
		public virtual Language Language { get; set; }
    }
}