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 SecurityGroupRequest : IRequest
{

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

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

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

                        public  SecurityGroupResultData FindBySearchCriteria(SecurityGroupSearchCriteria criteria)       
                {
return Task.Run(() =>   serviceRequest.PostAsJsonAsync<SecurityGroupSearchCriteria,SecurityGroupResultData>("/SecurityGroup/FindBySearchCriteria" , criteria)).GetAwaiter().GetResult();                }

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

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

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

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

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

                
}
}