using System;

namespace Ntp.Analyzer.Render
{
    public static class HtmlExtension
    {
        public static string AppendWithWebpath(this IHtmlObject htmlObject, string line, string link)
        {
            if (link.StartsWith("http") || link.StartsWith("https") || link.StartsWith("mailto"))
                return String.Format(line, String.Empty, link);

            return String.Format(line, htmlObject.WebPath, link);
        }

        public static string AppendWithWebpath(this IHtmlObject htmlObject, string line, string link, object arg0)
        {
            if (link.StartsWith("http") || link.StartsWith("https") || link.StartsWith("mailto"))
                return String.Format(line, String.Empty, link, arg0);

            return String.Format(line, htmlObject.WebPath, link, arg0);
        }

        public static string AppendWithWebpath(this IHtmlObject htmlObject, string line, string link, object arg0, object arg1)
        {
            if (link.StartsWith("http") || link.StartsWith("https") || link.StartsWith("mailto"))
                return String.Format(line, String.Empty, link, arg0, arg1);

            return String.Format(line, htmlObject.WebPath, link, arg0, arg1);
        }
    }
}