namespace AS1024.CommunityDocumentationPage.DIScopes
{
    public static class ValidateBgpCommunity
    {
        /// <summary>
        /// validates if this is a valid standard BGP Community
        /// </summary>
        /// <param name="Community">Community string represented as NNN:XXX</param>
        /// <returns>true if it's a valid bgp community, false if it isn't</returns>
        public static bool IsValidBgpCommunity(this string Community)
        {
            string[] splitStrings = 
                Community.Split(":", StringSplitOptions.RemoveEmptyEntries);

            for (int i = 0; i < 1; i++)
            {
                if (!int.TryParse(splitStrings[i], out int communityParsed)
                    && communityParsed > 65536)
                {
                    return false;
                }
            }
            return true;
        }
    }
}
