
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;
            using Microsoft.AspNetCore.Http;
            
namespace CloudBuilder.Request.AI
{

public class DmsFileRequest : IRequest
{

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

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

                        public  DmsFileResultData FindBySearchCriteria(DmsFileSearchCriteria criteria)       
                {
return Task.Run(() =>   serviceRequest.PostAsJsonAsync<DmsFileSearchCriteria,DmsFileResultData>("/DmsFile/FindBySearchCriteria" , criteria)).GetAwaiter().GetResult();                }

                        public  DmsFileResultData FindDatasBySearchCriteria(DmsFileSearchCriteria criteria)       
                {
return Task.Run(() =>   serviceRequest.PostAsJsonAsync<DmsFileSearchCriteria,DmsFileResultData>("/DmsFile/FindDatasBySearchCriteria" , criteria)).GetAwaiter().GetResult();                }

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

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

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

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

                        public  string GetFolderName(string folderLocalName)       
                {
return Task.Run(() =>   serviceRequest.PostAsJsonAsync<string>("/DmsFile/GetFolderName?folderLocalName=" + folderLocalName.ToString())).GetAwaiter().GetResult();                }

                        public  string CreateDmsFolder(DmsFileEntity dmsFile)       
                {
return Task.Run(() =>   serviceRequest.PostAsJsonAsync<DmsFileEntity,string>("/DmsFile/CreateDmsFolder" , dmsFile)).GetAwaiter().GetResult();                }

                        public  DmsFileEntity UpdateDmsFolder(DmsFileEntity dmsFile)       
                {
return Task.Run(() =>   serviceRequest.PostAsJsonAsync<DmsFileEntity,DmsFileEntity>("/DmsFile/UpdateDmsFolder" , dmsFile)).GetAwaiter().GetResult();                }

                        public   SelectOption[] FindDmsFolders()
                {
return  Task.Run(() =>  serviceRequest.PostAsJsonAsync<SelectOption[]> ("/DmsFile/FindDmsFolders")).GetAwaiter().GetResult();                }

                        public   DmsFolderTreeData FindDmsFolderTreeData()
                {
return  Task.Run(() =>  serviceRequest.PostAsJsonAsync<DmsFolderTreeData> ("/DmsFile/FindDmsFolderTreeData")).GetAwaiter().GetResult();                }

                        public void MoveDmsFolder(DmsFileEntity dmsFile)       
                {
 Task.Run(() =>   serviceRequest.PostAsJsonAsync<DmsFileEntity,dynamic>("/DmsFile/MoveDmsFolder" , dmsFile)).GetAwaiter().GetResult();                }

                        public   BookDmsFileViewEntity UploadFile()
                {
return  Task.Run(() =>  serviceRequest.PostAsJsonAsync<BookDmsFileViewEntity> ("/DmsFile/UploadFile")).GetAwaiter().GetResult();                }

                        public  dynamic DownloadFile(Int32 fileId)       
                {
return Task.Run(() =>   serviceRequest.PostAsJsonAsync<dynamic>("/DmsFile/DownloadFile?fileId=" + fileId.ToString())).GetAwaiter().GetResult();                }

                        public  dynamic DownloadFilePreview(DmsFileEntity dmsFile)       
                {
return Task.Run(() =>   serviceRequest.PostAsJsonAsync<DmsFileEntity,dynamic>("/DmsFile/DownloadFilePreview" , dmsFile)).GetAwaiter().GetResult();                }

                        public  dynamic DownloadFileCombine(string fileName)       
                {
return Task.Run(() =>   serviceRequest.PostAsJsonAsync<dynamic>("/DmsFile/DownloadFileCombine?fileName=" + fileName.ToString())).GetAwaiter().GetResult();                }

                        public  Int32 FindDmsFolderMapByFolderName(string folderName)       
                {
return Task.Run(() =>   serviceRequest.PostAsJsonAsync<Int32>("/DmsFile/FindDmsFolderMapByFolderName?folderName=" + folderName.ToString())).GetAwaiter().GetResult();                }

                        public  string FindFolderNameParentByFolderName(string folderName)       
                {
return Task.Run(() =>   serviceRequest.PostAsJsonAsync<string>("/DmsFile/FindFolderNameParentByFolderName?folderName=" + folderName.ToString())).GetAwaiter().GetResult();                }

                
}
}