var ServiceDataProvider={CallService:function(a,b,c){var d=$.Deferred();$.ajax({url:String.format(a,b),timeout:ApplicationSettings.callServiceTimeout,type:"POST",contentType:Constants.ContentTypeString,data:JSON.stringify(c),success:function(a){"object"!=typeof a&&(a=$.parseJSON(a));Log(a);var b=void 0,c=void 0;a?(b=a.ErrorCode,c=a.ErrorMessage):b=20;0<b?d.reject(b,c):d.resolve(a.ServiceActionResult)},error:function(){d.reject(10,void 0)},beforeSend:function(a){a.setRequestHeader("Accept",Constants.RequestHeaderString)}});
return d},downloadCalculationSettings:function(){return ServiceDataProvider.CallService(ApplicationSettings.configurationServiceUrl,ServiceActions.GetConfiguration,{userData:ServiceDataProvider.getCredentials()})},logIn:function(a,b){return ServiceDataProvider.CallService(ApplicationSettings.authorisationServiceUrl,ServiceActions.LogOn,{userName:a,password:b})},getCredentials:function(){return{Token:MainViewModel.token()}},downloadCars:function(){return ServiceDataProvider.CallService(ApplicationSettings.configurationServiceUrl,
ServiceActions.GetCars,{userData:ServiceDataProvider.getCredentials()})},downloadResidualValueCharts:function(){return ServiceDataProvider.CallService(ApplicationSettings.configurationServiceUrl,ServiceActions.GetResidualValues,{userData:ServiceDataProvider.getCredentials()})},register:function(a){return ServiceDataProvider.CallService(ApplicationSettings.authorisationServiceUrl,ServiceActions.Register,a)},downloadMyContracts:function(a,b){return ServiceDataProvider.CallService(ApplicationSettings.contractsServiceUrl,
ServiceActions.GetContracts,{userData:ServiceDataProvider.getCredentials(),skip:a,take:b})},addCalculation:function(a){return ServiceDataProvider.CallService(ApplicationSettings.contractsServiceUrl,ServiceActions.AddCalculation,{userData:ServiceDataProvider.getCredentials(),calculation:a})},updateUserProfile:function(a){return ServiceDataProvider.CallService(ApplicationSettings.authorisationServiceUrl,ServiceActions.UpdateUserProfile,{userData:ServiceDataProvider.getCredentials(),userProfile:a})},
downloadUserProfile:function(){return ServiceDataProvider.CallService(ApplicationSettings.authorisationServiceUrl,ServiceActions.GetUserProfile,{userData:ServiceDataProvider.getCredentials()})},downloadPoolObjects:function(a,b,c){return ServiceDataProvider.CallService(ApplicationSettings.poolObjectsServiceUrl,ServiceActions.GetPoolObjects,{userData:ServiceDataProvider.getCredentials(),skip:a,take:b,filterOutOrderOnly:c})},downloadPoolObject:function(a){return ServiceDataProvider.CallService(ApplicationSettings.poolObjectsServiceUrl,
ServiceActions.GetPoolObject,{userData:ServiceDataProvider.getCredentials(),id:a})}};
