//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
//     Copyright (c) Telligent Systems Corporation.  All rights reserved.
// </copyright> 
//------------------------------------------------------------------------------

using System;

namespace CommunityServer.Blogs.Components
{
	/// <summary>
	/// Summary description for PostConfigHelper.
	/// </summary>
	public class PostConfigHelper
	{
		private PostConfigHelper()
		{

		}

        public static BlogPostConfig SetPostConfig(BlogPostConfig current, BlogPostConfig change, bool isSelected)
        {
            if(isSelected)
            {
                current = current | change;
            }
            else
            {
                current = current & ~change;
            }

            return current;
        }

        /// <summary>
        /// Helper to get the current post config value
        /// </summary>
        public static bool GetPostConfig(BlogPostConfig current, BlogPostConfig valueToCheck)
        {
            return IsPostConfigSelected(current,valueToCheck);// (PostConfig & bpc) == bpc;
        }

        /// <summary>
        /// Helper to check if a specific property is set via the PostConfig
        /// </summary>
        public static bool IsPostConfigSelected(BlogPostConfig current, BlogPostConfig item)
        {
            return (current & item) == item;
        }
	}
}
