using System.Web.Http;
using Newtonsoft.Json.Serialization;
using SimpleInjector;
using SimpleInjector.Integration.WebApi;

namespace Symbio.BestPractice.DotNet.Web
{
    public static class WebApiConfig
    {
        public static void Configure(HttpConfiguration config, Container container)
        {
            container.RegisterWebApiControllers(config, typeof(WebApiConfig).Assembly);

            config.MapHttpAttributeRoutes();
            config.Formatters.JsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
            config.Formatters.JsonFormatter.UseDataContractJsonSerializer = false;
            config.DependencyResolver = new SimpleInjectorWebApiDependencyResolver(container);
            config.EnsureInitialized();
        }
    }
}
