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

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

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

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

                        public  AiChapterResultData FindBySearchCriteria(AiChapterSearchCriteria criteria)       
                {
return Task.Run(() =>   serviceRequest.PostAsJsonAsync<AiChapterSearchCriteria,AiChapterResultData>("/AiChapter/FindBySearchCriteria" , criteria)).GetAwaiter().GetResult();                }

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

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

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

                
}
}