using CloudBuilder.Core.DependencyInjection.Request;
using CloudBuilder.Core.Request;
using CloudBuilder.Core.Service;
using Microsoft.Extensions.DependencyInjection;
using CloudBuilder.Security.Service;
            using CloudBuilder.Core.DatabaseAccessor.Entity;
            using Microsoft.AspNetCore.Http;
            using CloudBuilder.Core.Policy;
            using CloudBuilder.Core.DependencyInjection.Request;
            using CloudBuilder.Security.Data;
            using CloudBuilder.Core.Authorization;
            using CloudBuilder.Security.Entity;
            using CloudBuilder.Security.SearchCriteria;
            using CloudBuilder.Security;
            
namespace CloudBuilder.Request.Security
{

public class LocaleRequest : IRequest
{

private readonly IServiceRequest serviceRequest;
public LocaleRequest(IServiceRequest serviceRequest)
{
this.serviceRequest = serviceRequest;
}

        public   LocaleEntity[] FindAll()
                {
return Task.Run(() => serviceRequest.GetAsync<LocaleEntity[]>("/Locale/FindAll")).GetAwaiter().GetResult();                }

                        public  LocaleResultData FindBySearchCriteria(LocaleSearchCriteria criteria)       
                {
return Task.Run(() =>   serviceRequest.PostAsJsonAsync<LocaleSearchCriteria,LocaleResultData>("/Locale/FindBySearchCriteria" , criteria)).GetAwaiter().GetResult();                }

                        public  LocaleEntity FindByKey(LocaleEntityKey key)       
                {
return Task.Run(() =>   serviceRequest.PostAsJsonAsync<LocaleEntityKey,LocaleEntity>("/Locale/FindByKey" , key)).GetAwaiter().GetResult();                }

                        public  LocaleEntity Insert(LocaleEntity data)       
                {
return Task.Run(() =>   serviceRequest.PostAsJsonAsync<LocaleEntity,LocaleEntity>("/Locale/Insert" , data)).GetAwaiter().GetResult();                }

                        public  LocaleEntity Update(LocaleEntity data)       
                {
return Task.Run(() =>   serviceRequest.PostAsJsonAsync<LocaleEntity,LocaleEntity>("/Locale/Update" , data)).GetAwaiter().GetResult();                }

                        public void UpdateLocaleData(LocaleData data)       
                {
 Task.Run(() =>   serviceRequest.PostAsJsonAsync<LocaleData,dynamic>("/Locale/UpdateLocaleData" , data)).GetAwaiter().GetResult();                }

                        public void Delete(LocaleEntityKey key)       
                {
 Task.Run(() =>   serviceRequest.PostAsJsonAsync<LocaleEntityKey,dynamic>("/Locale/Delete" , key)).GetAwaiter().GetResult();                }

                
}
}