using System;
using System.Net;
using System.Net.Http;
using System.Web;
using Unibase.Platform.Keys;
using Unibase.Dependency;
using Unibase.Platform.Data;
using Unibase.Platform.Managers;
using Unibase.Platform.Templates.Providers;
using System.Threading.Tasks;



namespace Bizgaze.CRM.Visitors.Providers.TemplateProvider
{
    public class VisitorTemplateProvider : BaseManager, ITemplateProvider
    {
        public string GroupName
        {
            get
            {
                return "Visitors";
            }
        }

        public string Notes
        {
            get
            {
                return "Visitors Template";
            }
        }

        public Package ProviderClass
        {

            get { return new Package(this.GetType().AssemblyQualifiedName); }

        }
        public string ViewName
        {
            get
            {
                return "Unibase_TemplateProviders";
            }
        }
        public string RefColumn
        {
            get
            {
                return null;
            }
        }

        public UniqueKey SystemName
        {
            get
            {
                return Bizgaze.CRM.TemplateProviders.Visitors;
            }
        }

        public string TemplateProviderName
        {
            get
            {
                return "Visitor Template";
            }
        }
        public string GetSubject(SelectRequest request, string RefId, string SqlWhere)
        {
            return string.Empty;
        }
        public string GetBody(SelectRequest request, string RefId, string SqlWhere)
        {
            return string.Empty;
        }

        public UniqueKey AppProviderUniqueName
        {
            get
            {
                return Bizgaze.CRM.Apps.Visitors;
            }
        }

        public async Task<string> GetHtmlAsync(SelectRequest srequest, long TemplateId, bool IsExcise, long visitorid)
        {
            var manager = DependencyConfig.Resolve<Bizgaze.CRM.Visitors.Managers.IVisitorManager>();
            var templateText = await manager.GetVisitorshtmlAsync(srequest, visitorid);
            if (templateText.Result != null)
            {
                return templateText.Result.PrintHTML;
            }
            else
            {
                return templateText.Message;
            }
        }

        public string GetHtml(SelectRequest srequest, long TemplateId, bool IsExcise, long Id)
        {
            return null;
        }

        public string GenerateTemplatePdf(SelectRequest srequest, long TemplateId, long Id)
        {
            return null;
        }

        public Task<string> GenerateTemplatePdfAsync(SelectRequest srequest, long TemplateId, long Id)
        {
            return null;
        }
    }


}

