
using CloudBuilder.Core.DependencyInjection.Request;
using CloudBuilder.Core.Request;
using CloudBuilder.Core.Service;
using Microsoft.Extensions.DependencyInjection;
using CloudBuilder.AI.Service;
            using CloudBuilder.Core.DatabaseAccessor.Entity;
            using CloudBuilder.AI.Entity;
            using System;
            using CloudBuilder.AI.Data;
            using CloudBuilder.AI.SearchCriteria;
            
namespace CloudBuilder.Request.AI
{

public class AiBookRequest : IRequest
{

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

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

                        public  AiBookEntity FindByTitle(string title)       
                {
return Task.Run(() =>   serviceRequest.PostAsJsonAsync<AiBookEntity>("/AiBook/FindByTitle?title=" + title.ToString())).GetAwaiter().GetResult();                }

                        public  AiBookResultData FindBySearchCriteria(AiBookSearchCriteria criteria)       
                {
return Task.Run(() =>   serviceRequest.PostAsJsonAsync<AiBookSearchCriteria,AiBookResultData>("/AiBook/FindBySearchCriteria" , criteria)).GetAwaiter().GetResult();                }

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

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

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

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

                
                    public class ProcessBookCompositionData3                    { 
                     public string key { get; set; }
                         public string encoding { get; set; }
                         public string pattern { get; set; }
                        
                    }
                            public  AiBookData ProcessBook(string key, string encoding, string pattern)       
                {
var compositionData = new ProcessBookCompositionData3{	
key = key,	
encoding = encoding,	
pattern = pattern };	
return Task.Run(() =>  serviceRequest.PostAsJsonAsync<ProcessBookCompositionData3, AiBookData>("/AiBook/ProcessBook", compositionData)).GetAwaiter().GetResult();                }

                        public void ExtractNames(string bookGuid)       
                {
 Task.Run(() =>   serviceRequest.PostAsync("/AiBook/ExtractNames?bookGuid=" + bookGuid.ToString())).GetAwaiter().GetResult();                }

                
                    public class ExtractNamesByChapterGuidCompositionData2                    { 
                     public string bookGuid { get; set; }
                         public string chapterGuid { get; set; }
                        
                    }
                            public void ExtractNamesByChapterGuid(string bookGuid, string chapterGuid)       
                {
var compositionData = new ExtractNamesByChapterGuidCompositionData2{	
bookGuid = bookGuid,	
chapterGuid = chapterGuid };	
 Task.Run(() =>  serviceRequest.PostAsJsonAsync<ExtractNamesByChapterGuidCompositionData2, dynamic>("/AiBook/ExtractNamesByChapterGuid", compositionData)).GetAwaiter().GetResult();                }

                
}
}