using CloudBuilder.Core.DependencyInjection.Request;
using CloudBuilder.Core.Policy;
using DocumentFormat.OpenXml.InkML;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CloudBuilder.Core.DependencyInjection.Form
{
    public class ApplicationServiceContext
    {
        public static IServiceProvider ServiceProvider = null!;
        public static IContext Context = null!;
        public static IConfiguration Configuration;
        public static ILocaleMessageManager localeMessageManager = null!;
        public static ISecurityMasterManager securityMasterManager = null!;
        public ApplicationServiceContext(IServiceProvider serviceProvider, IContext context, IConfiguration configuration)
        {
            ServiceProvider = serviceProvider;
            Context = context;
            Context.DefaultVersion = configuration.GetValue<string>("CloudBuilder:DefaultVersion")!;
            Context.DefaultCopyright = configuration.GetValue<string>("CloudBuilder:DefaultCopyright")!;
            Context.DefaultTitle = configuration.GetValue<string>("CloudBuilder:DefaultTitle")!;

            Configuration = configuration;
            localeMessageManager = ServiceProvider.GetService<ILocaleMessageManager>()!;
            securityMasterManager = ServiceProvider.GetService<ISecurityMasterManager>()!;
        }
    }
}
