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

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

        public  SecurityLockEntity FindByKey(SecurityLockEntityKey key)       
                {
return Task.Run(() =>   serviceRequest.PostAsJsonAsync<SecurityLockEntityKey,SecurityLockEntity>("/SecurityLock/FindByKey" , key)).GetAwaiter().GetResult();                }

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

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

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

                
                    public class IsLockedCompositionData2                    { 
                     public string entityName { get; set; }
                         public string key { get; set; }
                        
                    }
                            public  bool IsLocked(string entityName, string key)       
                {
var compositionData = new IsLockedCompositionData2{	
entityName = entityName,	
key = key };	
return Task.Run(() =>  serviceRequest.PostAsJsonAsync<IsLockedCompositionData2, bool>("/SecurityLock/IsLocked", compositionData)).GetAwaiter().GetResult();                }

                
                    public class LockCompositionData3                    { 
                     public string entityName { get; set; }
                         public string key { get; set; }
                         public string username { get; set; }
                        
                    }
                            public void Lock(string entityName, string key, string username)       
                {
var compositionData = new LockCompositionData3{	
entityName = entityName,	
key = key,	
username = username };	
 Task.Run(() =>  serviceRequest.PostAsJsonAsync<LockCompositionData3, dynamic>("/SecurityLock/Lock", compositionData)).GetAwaiter().GetResult();                }

                
                    public class ForceLockCompositionData3                    { 
                     public string entityName { get; set; }
                         public string key { get; set; }
                         public string username { get; set; }
                        
                    }
                            public void ForceLock(string entityName, string key, string username)       
                {
var compositionData = new ForceLockCompositionData3{	
entityName = entityName,	
key = key,	
username = username };	
 Task.Run(() =>  serviceRequest.PostAsJsonAsync<ForceLockCompositionData3, dynamic>("/SecurityLock/ForceLock", compositionData)).GetAwaiter().GetResult();                }

                
                    public class ConsumeLockCompositionData3                    { 
                     public string entityName { get; set; }
                         public string key { get; set; }
                         public string username { get; set; }
                        
                    }
                            public void ConsumeLock(string entityName, string key, string username)       
                {
var compositionData = new ConsumeLockCompositionData3{	
entityName = entityName,	
key = key,	
username = username };	
 Task.Run(() =>  serviceRequest.PostAsJsonAsync<ConsumeLockCompositionData3, dynamic>("/SecurityLock/ConsumeLock", compositionData)).GetAwaiter().GetResult();                }

                
                    public class ClearLockCompositionData2                    { 
                     public string entityName { get; set; }
                         public string key { get; set; }
                        
                    }
                            public void ClearLock(string entityName, string key)       
                {
var compositionData = new ClearLockCompositionData2{	
entityName = entityName,	
key = key };	
 Task.Run(() =>  serviceRequest.PostAsJsonAsync<ClearLockCompositionData2, dynamic>("/SecurityLock/ClearLock", compositionData)).GetAwaiter().GetResult();                }

                
}
}