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;
            using System;
            
namespace CloudBuilder.Request.Security
{

public class SecurityActorRequest : IRequest
{

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

        public  SecurityActorData FindByKey(string key)       
                {
return Task.Run(() =>   serviceRequest.PostAsJsonAsync<SecurityActorData>("/SecurityActor/FindByKey?key=" + key.ToString())).GetAwaiter().GetResult();                }

                        public   SecurityActorEntity[] FindAll()
                {
return  Task.Run(() =>  serviceRequest.PostAsJsonAsync<SecurityActorEntity[]> ("/SecurityActor/FindAll")).GetAwaiter().GetResult();                }

                        public   SecurityActorEntity[] FindAllByNoPermission()
                {
return  Task.Run(() =>  serviceRequest.PostAsJsonAsync<SecurityActorEntity[]> ("/SecurityActor/FindAllByNoPermission")).GetAwaiter().GetResult();                }

                        public  SecurityActorResultData FindBySearchCriteria(SecurityActorSearchCriteria criteria)       
                {
return Task.Run(() =>   serviceRequest.PostAsJsonAsync<SecurityActorSearchCriteria,SecurityActorResultData>("/SecurityActor/FindBySearchCriteria" , criteria)).GetAwaiter().GetResult();                }

                        public  dynamic PrintBySearchCriteria(SecurityActorSearchCriteria criteria)       
                {
return Task.Run(() =>   serviceRequest.PostAsJsonAsync<SecurityActorSearchCriteria,dynamic>("/SecurityActor/PrintBySearchCriteria" , criteria)).GetAwaiter().GetResult();                }

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

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

                        public void Delete(string key)       
                {
 Task.Run(() =>   serviceRequest.PostAsync("/SecurityActor/Delete?key=" + key.ToString())).GetAwaiter().GetResult();                }

                        public void Deletes(string[] keys)       
                {
 Task.Run(() =>   serviceRequest.PostAsJsonAsync<string[],dynamic>("/SecurityActor/Deletes" , keys)).GetAwaiter().GetResult();                }

                
}
}