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

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

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

                        public  SecurityFunctionResultData FindBySearchCriteria(SecurityFunctionSearchCriteria criteria)       
                {
return Task.Run(() =>   serviceRequest.PostAsJsonAsync<SecurityFunctionSearchCriteria,SecurityFunctionResultData>("/SecurityFunction/FindBySearchCriteria" , criteria)).GetAwaiter().GetResult();                }

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

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

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

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

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

                        public  SecurityFunctionEntity FindByFunctionName(string functionName)       
                {
return Task.Run(() =>   serviceRequest.PostAsJsonAsync<SecurityFunctionEntity>("/SecurityFunction/FindByFunctionName?functionName=" + functionName.ToString())).GetAwaiter().GetResult();                }

                        public   SecurityFunctionDisplayData[] FindMenus()
                {
return  Task.Run(() =>  serviceRequest.PostAsJsonAsync<SecurityFunctionDisplayData[]> ("/SecurityFunction/FindMenus")).GetAwaiter().GetResult();                }

                
}
}