import { PaginationOptions } from './models/pagination.model';
import { UserModel } from './models/user.model';

export function SERVER_METHODS(resolveioServer) {
	return {
		aiAssistantMongoAggregate: (payload, cb?: Function): Promise<any> => {
			return resolveioServer.call('aiAssistantMongoAggregate', payload, cb);
		},
		aiAssistantMongoRead: (payload, cb?: Function): Promise<any> => {
			return resolveioServer.call('aiAssistantMongoRead', payload, cb);
		},
		aiAssistantReportBuilderAggregate: (payload, cb?: Function): Promise<any> => {
			return resolveioServer.call('aiAssistantReportBuilderAggregate', payload, cb);
		},
		aiAssistantReportBuilderRead: (payload, cb?: Function): Promise<any> => {
			return resolveioServer.call('aiAssistantReportBuilderRead', payload, cb);
		},
		aiCoderTerminalDeployTest: (cb?: Function): Promise<any> => {
			return resolveioServer.call('aiCoderTerminalDeployTest', cb);
		},
		aiCoderTerminalReportIssue: (payload, cb?: Function): Promise<any> => {
			return resolveioServer.call('aiCoderTerminalReportIssue', payload, cb);
		},
		aiCoderTerminalRunCodex: (payload, cb?: Function): Promise<any> => {
			return resolveioServer.call('aiCoderTerminalRunCodex', payload, cb);
		},
		aiCoderTerminalRunStatus: (payload, cb?: Function): Promise<any> => {
			return resolveioServer.call('aiCoderTerminalRunStatus', payload, cb);
		},
		aiCoderTerminalUploadFile: (id_conversation: string, file_name: string, content_base64: string, size: number, content_type?: string, cb?: Function): Promise<any> => {
			return resolveioServer.call('aiCoderTerminalUploadFile', id_conversation, file_name, content_base64, size, content_type, cb);
		},
		aiFormPatch: (payload, cb?: Function): Promise<any> => {
			return resolveioServer.call('aiFormPatch', payload, cb);
		},
		aiTerminalConversationCreate: (payload, cb?: Function): Promise<any> => {
			return resolveioServer.call('aiTerminalConversationCreate', payload, cb);
		},
		aiTerminalConversationDelete: (id_conversation: string, cb?: Function): Promise<any> => {
			return resolveioServer.call('aiTerminalConversationDelete', id_conversation, cb);
		},
		aiTerminalConversationUpdate: (id_conversation: string, patch, cb?: Function): Promise<any> => {
			return resolveioServer.call('aiTerminalConversationUpdate', id_conversation, patch, cb);
		},
		aiTerminalRun: (payload, cb?: Function): Promise<any> => {
			return resolveioServer.call('aiTerminalRun', payload, cb);
		},
		aiTerminalUploadFile: (id_conversation: string, file_name: string, content_base64: string, size: number, content_type?: string, cb?: Function): Promise<any> => {
			return resolveioServer.call('aiTerminalUploadFile', id_conversation, file_name, content_base64, size, content_type, cb);
		},
		appSettingsUpsert: (settings: any, cb?: Function): Promise<any> => {
			return resolveioServer.call('appSettingsUpsert', settings, cb);
		},
		collectionListAll: (cb?: Function): Promise<any> => {
			return resolveioServer.call('collectionListAll', cb);
		},
		collectionListRB: (cb?: Function): Promise<any> => {
			return resolveioServer.call('collectionListRB', cb);
		},
		countCollection: (collectionType: string, cb?: Function): Promise<any> => {
			return resolveioServer.call('countCollection', collectionType, cb);
		},
		countCollectionWithQuery: (collectionType: string, query: Object, cb?: Function): Promise<any> => {
			return resolveioServer.call('countCollectionWithQuery', collectionType, query, cb);
		},
		createCustomerNotification: (payload, cb?: Function): Promise<any> => {
			return resolveioServer.call('createCustomerNotification', payload, cb);
		},
		createUserAndEmailEnrollment: (newUser: UserModel, sendEnrollmentEmail = true, cb?: Function): Promise<any> => {
			return resolveioServer.call('createUserAndEmailEnrollment', newUser, sendEnrollmentEmail, cb);
		},
		cronCommunicationMetricsSync: (cb?: Function): Promise<any> => {
			return resolveioServer.call('cronCommunicationMetricsSync', cb);
		},
		cronEmailMergedDocsCleanUp: (cb?: Function): Promise<any> => {
			return resolveioServer.call('cronEmailMergedDocsCleanUp', cb);
		},
		cronOpenAIUsageBillingSync: (cb?: Function): Promise<any> => {
			return resolveioServer.call('cronOpenAIUsageBillingSync', cb);
		},
		deleteFile: (key: string, cb?: Function): Promise<any> => {
			return resolveioServer.call('deleteFile', key, cb);
		},
		deleteFileWithId: (id_file: string, cb?: Function): Promise<any> => {
			return resolveioServer.call('deleteFileWithId', id_file, cb);
		},
		deleteFiles: (keys: string[], cb?: Function): Promise<any> => {
			return resolveioServer.call('deleteFiles', keys, cb);
		},
		disconnectWS: (id_ws, cb?: Function): Promise<any> => {
			return resolveioServer.call('disconnectWS', id_ws, cb);
		},
		emailFile: (id_file: string, email: string, additional_message, cb?: Function): Promise<any> => {
			return resolveioServer.call('emailFile', id_file, email, additional_message, cb);
		},
		find: (collection: string, query = {}, sortQuery = {}, cb?: Function): Promise<any> => {
			return resolveioServer.call('find', collection, query, sortQuery, cb);
		},
		findOne: (collection: string, query = {}, cb?: Function): Promise<any> => {
			return resolveioServer.call('findOne', collection, query, cb);
		},
		findWithOptions: (collection: string, query: Object, options: PaginationOptions, cb?: Function): Promise<any> => {
			return resolveioServer.call('findWithOptions', collection, query, options, cb);
		},
		generatePDF: (html, fileName, orientation = 'portrait', fontSize = '12px', upload = false, uploadFileOrder = -1, uploadFileType = '', cb?: Function): Promise<any> => {
			return resolveioServer.call('generatePDF', html, fileName, orientation, fontSize, upload, uploadFileOrder, uploadFileType, cb);
		},
		generatePDFNoPageNumber: (html, fileName, orientation = 'portrait', fontSize = '12px', upload = false, uploadFileOrder = -1, uploadFileType = '', cb?: Function): Promise<any> => {
			return resolveioServer.call('generatePDFNoPageNumber', html, fileName, orientation, fontSize, upload, uploadFileOrder, uploadFileType, cb);
		},
		getCustomerPortalUserPassword: (userId: string, cb?: Function): Promise<any> => {
			return resolveioServer.call('getCustomerPortalUserPassword', userId, cb);
		},
		getDataURIfromURL: (url: string, cb?: Function): Promise<any> => {
			return resolveioServer.call('getDataURIfromURL', url, cb);
		},
		getSignedUrl: (key: string, expires: number, cb?: Function): Promise<any> => {
			return resolveioServer.call('getSignedUrl', key, expires, cb);
		},
		getSignedUrlUSEast1BucketAndKey: (bucket: string, key: string, expires: number, cb?: Function): Promise<any> => {
			return resolveioServer.call('getSignedUrlUSEast1BucketAndKey', bucket, key, expires, cb);
		},
		getSignedUrlWithId: (id_file: string, expires: number, cb?: Function): Promise<any> => {
			return resolveioServer.call('getSignedUrlWithId', id_file, expires, cb);
		},
		getSignedUrls: (keys: string[], expires: number, cb?: Function): Promise<any> => {
			return resolveioServer.call('getSignedUrls', keys, expires, cb);
		},
		getSignedUrlsAndFilesWithId: (ids: string[], expires: number, cb?: Function): Promise<any> => {
			return resolveioServer.call('getSignedUrlsAndFilesWithId', ids, expires, cb);
		},
		incCounter: (counterType: string, cb?: Function): Promise<any> => {
			return resolveioServer.call('incCounter', counterType, cb);
		},
		incorrectUser: (old_user, new_user, client_subs, cb?: Function): Promise<any> => {
			return resolveioServer.call('incorrectUser', old_user, new_user, client_subs, cb);
		},
		insertDocument: (collection: string, document: Object, cb?: Function): Promise<any> => {
			return resolveioServer.call('insertDocument', collection, document, cb);
		},
		insertErrorLog: (message, data, cb?: Function): Promise<any> => {
			return resolveioServer.call('insertErrorLog', message, data, cb);
		},
		insertManyDocuments: (collection: string, documents: Object[], cb?: Function): Promise<any> => {
			return resolveioServer.call('insertManyDocuments', collection, documents, cb);
		},
		insertSubscriptionLog: (type, subscription, collection_name, subData, cb?: Function): Promise<any> => {
			return resolveioServer.call('insertSubscriptionLog', type, subscription, collection_name, subData, cb);
		},
		listCustomerNotifications: (payload?, cb?: Function): Promise<any> => {
			return resolveioServer.call('listCustomerNotifications', payload, cb);
		},
		markAllUserNotificationsRead: (id_client?: string, cb?: Function): Promise<any> => {
			return resolveioServer.call('markAllUserNotificationsRead', id_client, cb);
		},
		markUserNotificationRead: (id_notification: string, cb?: Function): Promise<any> => {
			return resolveioServer.call('markUserNotificationRead', id_notification, cb);
		},
		mergePDFResolve: (fileKeys: string[], fileName: string, fileType?: string, cb?: Function): Promise<any> => {
			return resolveioServer.call('mergePDFResolve', fileKeys, fileName, fileType, cb);
		},
		mergePDFResolveHtml: (htmls: string[], fileName: string, fileType?: string, save = true, cb?: Function): Promise<any> => {
			return resolveioServer.call('mergePDFResolveHtml', htmls, fileName, fileType, save, cb);
		},
		mergePDFResolveNoSave: (fileKeys: string[], cb?: Function): Promise<any> => {
			return resolveioServer.call('mergePDFResolveNoSave', fileKeys, cb);
		},
		mongoExplorerAggregate: (database: string, collection: string, pipeline: any[], options: any = {}, cb?: Function): Promise<any> => {
			return resolveioServer.call('mongoExplorerAggregate', database, collection, pipeline, options, cb);
		},
		mongoExplorerAiSuggest: (payload: any, cb?: Function): Promise<any> => {
			return resolveioServer.call('mongoExplorerAiSuggest', payload, cb);
		},
		mongoExplorerCommand: (database: string, command: any, permissionView?: string, mode?: string, cb?: Function): Promise<any> => {
			return resolveioServer.call('mongoExplorerCommand', database, command, permissionView, mode, cb);
		},
		mongoExplorerDeleteDocument: (database: string, collection: string, doc_id: string, permissionView?: string, force = false, mode?: string, cb?: Function): Promise<any> => {
			return resolveioServer.call('mongoExplorerDeleteDocument', database, collection, doc_id, permissionView, force, mode, cb);
		},
		mongoExplorerDeleteImpact: (database: string, collection: string, doc_id: string, cb?: Function): Promise<any> => {
			return resolveioServer.call('mongoExplorerDeleteImpact', database, collection, doc_id, cb);
		},
		mongoExplorerFind: (database: string, collection: string, query: any = {}, options?, cb?: Function): Promise<any> => {
			return resolveioServer.call('mongoExplorerFind', database, collection, query, options, cb);
		},
		mongoExplorerGetCollectionSchema: (database: string, collection: string, cb?: Function): Promise<any> => {
			return resolveioServer.call('mongoExplorerGetCollectionSchema', database, collection, cb);
		},
		mongoExplorerInsertDocument: (database: string, collection: string, document: any, permissionView?: string, mode?: string, cb?: Function): Promise<any> => {
			return resolveioServer.call('mongoExplorerInsertDocument', database, collection, document, permissionView, mode, cb);
		},
		mongoExplorerListCollections: (database?: string, cb?: Function): Promise<any> => {
			return resolveioServer.call('mongoExplorerListCollections', database, cb);
		},
		mongoExplorerReplaceDocument: (database: string, collection: string, document: any, permissionView?: string, mode?: string, cb?: Function): Promise<any> => {
			return resolveioServer.call('mongoExplorerReplaceDocument', database, collection, document, permissionView, mode, cb);
		},
		monitorCPUs: (cb?: Function): Promise<any> => {
			return resolveioServer.call('monitorCPUs', cb);
		},
		monitorMemorys: (cb?: Function): Promise<any> => {
			return resolveioServer.call('monitorMemorys', cb);
		},
		monitorMongos: (cb?: Function): Promise<any> => {
			return resolveioServer.call('monitorMongos', cb);
		},
		queryLogsForDashboard: (payload: any = {}, cb?: Function): Promise<any> => {
			return resolveioServer.call('queryLogsForDashboard', payload, cb);
		},
		queryResolveIOLogsRemote: (payload: any = {}, cb?: Function): Promise<any> => {
			return resolveioServer.call('queryResolveIOLogsRemote', payload, cb);
		},
		reconnectWS: (id_ws, cb?: Function): Promise<any> => {
			return resolveioServer.call('reconnectWS', id_ws, cb);
		},
		reloadWS: (id_ws, cb?: Function): Promise<any> => {
			return resolveioServer.call('reloadWS', id_ws, cb);
		},
		removeDocument: (collection: string, doc_id: string, cb?: Function): Promise<any> => {
			return resolveioServer.call('removeDocument', collection, doc_id, cb);
		},
		removeDocumentWithQuery: (collection: string, query: Object, cb?: Function): Promise<any> => {
			return resolveioServer.call('removeDocumentWithQuery', collection, query, cb);
		},
		removeDocumentsWithQuery: (collection: string, query: Object, cb?: Function): Promise<any> => {
			return resolveioServer.call('removeDocumentsWithQuery', collection, query, cb);
		},
		reportBuilderAiSuggest: (payload: any, cb?: Function): Promise<any> => {
			return resolveioServer.call('reportBuilderAiSuggest', payload, cb);
		},
		reportBuilderBuildTree: (collection_root: string, collectionJoins: any[] = [], cb?: Function): Promise<any> => {
			return resolveioServer.call('reportBuilderBuildTree', collection_root, collectionJoins, cb);
		},
		reportBuilderGetDistinctValue: (treeLeaf, cb?: Function): Promise<any> => {
			return resolveioServer.call('reportBuilderGetDistinctValue', treeLeaf, cb);
		},
		reportBuilderGetResults: (reportType: string, rootCollectionName: string, rootOptions: PaginationOptions, filters: any[] = [], filterArrays: any[] = [], filterArrayFields: any[] = [], selectedFields: any[] = [], customFields: any[] = [], groupsRow: any[] = [], fieldsTotal: any[] = [], fieldsLink: any[] = [], date_field = '', date_interval = '', displayType = '', cb?: Function): Promise<any> => {
			return resolveioServer.call('reportBuilderGetResults', reportType, rootCollectionName, rootOptions, filters, filterArrays, filterArrayFields, selectedFields, customFields, groupsRow, fieldsTotal, fieldsLink, date_field, date_interval, displayType, cb);
		},
		reportbuilderCronJob: (data: Object, cb?: Function): Promise<any> => {
			return resolveioServer.call('reportbuilderCronJob', data, cb);
		},
		reportbuilderreportWithId: (id: string, cb?: Function): Promise<any> => {
			return resolveioServer.call('reportbuilderreportWithId', id, cb);
		},
		resetUserPassword: (userId: string, cb?: Function): Promise<any> => {
			return resolveioServer.call('resetUserPassword', userId, cb);
		},
		runPublication: (publication: string, subscriptionData: any[] = [], userId?: string, cb?: Function): Promise<any> => {
			return resolveioServer.call('runPublication', publication, subscriptionData, userId, cb);
		},
		saveUserStickySelects: (stickySelects: any[], id_user?: string, cb?: Function): Promise<any> => {
			return resolveioServer.call('saveUserStickySelects', stickySelects, id_user, cb);
		},
		setUserPassword: (userId: string, password: string, cb?: Function): Promise<any> => {
			return resolveioServer.call('setUserPassword', userId, password, cb);
		},
		stuckCronJob: (cb?: Function): Promise<any> => {
			return resolveioServer.call('stuckCronJob', cb);
		},
		superAdminDeploySlowQueryLog: (logId: string, cb?: Function): Promise<any> => {
			return resolveioServer.call('superAdminDeploySlowQueryLog', logId, cb);
		},
		superAdminListAiAssistantIssueReports: (payload: Record<string, any> = {}, cb?: Function): Promise<any> => {
			return resolveioServer.call('superAdminListAiAssistantIssueReports', payload, cb);
		},
		superAdminListAutoFixLogs: (payload: Record<string, any> = {}, cb?: Function): Promise<any> => {
			return resolveioServer.call('superAdminListAutoFixLogs', payload, cb);
		},
		superAdminListSlowQueryLogs: (payload: Record<string, any> = {}, cb?: Function): Promise<any> => {
			return resolveioServer.call('superAdminListSlowQueryLogs', payload, cb);
		},
		superAdminRunAiAssistantIssueRemediation: (issueId: string, force?: boolean, cb?: Function): Promise<any> => {
			return resolveioServer.call('superAdminRunAiAssistantIssueRemediation', issueId, force, cb);
		},
		superAdminRunAiAssistantIssueReplay: (issueId: string, force?: boolean, cb?: Function): Promise<any> => {
			return resolveioServer.call('superAdminRunAiAssistantIssueReplay', issueId, force, cb);
		},
		superAdminRunAutoFixLog: (logId: string, cb?: Function): Promise<any> => {
			return resolveioServer.call('superAdminRunAutoFixLog', logId, cb);
		},
		superAdminRunSlowQueryLog: (logId: string, cb?: Function): Promise<any> => {
			return resolveioServer.call('superAdminRunSlowQueryLog', logId, cb);
		},
		superadminAPM: (date_start: Date, date_end: Date, graphInterval, cb?: Function): Promise<any> => {
			return resolveioServer.call('superadminAPM', date_start, date_end, graphInterval, cb);
		},
		superadminMonitorGraphData: (date_start: Date, date_end: Date, collection: string, instance: string, client: string, graphInterval: string, variable: string, variableType: string, cb?: Function): Promise<any> => {
			return resolveioServer.call('superadminMonitorGraphData', date_start, date_end, collection, instance, client, graphInterval, variable, variableType, cb);
		},
		superadminMonitorTableData: (date_start: Date, date_end: Date, collection: string, instance: string, client: string, graphInterval: string, variable: string, variableType: string, cb?: Function): Promise<any> => {
			return resolveioServer.call('superadminMonitorTableData', date_start, date_end, collection, instance, client, graphInterval, variable, variableType, cb);
		},
		supportCreateBillingUser: (user, cb?: Function): Promise<any> => {
			return resolveioServer.call('supportCreateBillingUser', user, cb);
		},
		supportGetSupportTicketWithId: (id_support_ticket, cb?: Function): Promise<any> => {
			return resolveioServer.call('supportGetSupportTicketWithId', id_support_ticket, cb);
		},
		supportInsertSupportTicket: (supportTicket, cb?: Function): Promise<any> => {
			return resolveioServer.call('supportInsertSupportTicket', supportTicket, cb);
		},
		supportUpdateSupportTicket: (supportTicket, cb?: Function): Promise<any> => {
			return resolveioServer.call('supportUpdateSupportTicket', supportTicket, cb);
		},
		supportticketCount: (searchString, filters, cb?: Function): Promise<any> => {
			return resolveioServer.call('supportticketCount', searchString, filters, cb);
		},
		supportticketsWithOptions: (options, searchString, filters, cb?: Function): Promise<any> => {
			return resolveioServer.call('supportticketsWithOptions', options, searchString, filters, cb);
		},
		updateDocument: (collection: string, f_document: Object, cb?: Function): Promise<any> => {
			return resolveioServer.call('updateDocument', collection, f_document, cb);
		},
		updateDocumentOffline: (collection: string, f_document: Object, cb?: Function): Promise<any> => {
			return resolveioServer.call('updateDocumentOffline', collection, f_document, cb);
		},
		updateDocumentProps: (collection: string, doc_id: string, updateParams: any[], doc__v?: number, cb?: Function): Promise<any> => {
			return resolveioServer.call('updateDocumentProps', collection, doc_id, updateParams, doc__v, cb);
		},
		updateDocumentPropsOffline: (collection: string, doc_id: string, updateParams: any[], doc__v: number, cb?: Function): Promise<any> => {
			return resolveioServer.call('updateDocumentPropsOffline', collection, doc_id, updateParams, doc__v, cb);
		},
		uploadFileAndSave: (fileName: string, fileData: string, fileSize: number, fileOrder: number, fileType: string, compress: Boolean, cb?: Function): Promise<any> => {
			return resolveioServer.call('uploadFileAndSave', fileName, fileData, fileSize, fileOrder, fileType, compress, cb);
		},
		uploadNonPDFBufferAndSave: (fileName: string, fileDataBuffer, fileSize: number, fileOrder: number, fileType: string, cb?: Function): Promise<any> => {
			return resolveioServer.call('uploadNonPDFBufferAndSave', fileName, fileDataBuffer, fileSize, fileOrder, fileType, cb);
		},
		uploadNonPDFFileAndSave: (fileName: string, fileData: string, fileSize: number, fileOrder: number, fileType: string, cb?: Function): Promise<any> => {
			return resolveioServer.call('uploadNonPDFFileAndSave', fileName, fileData, fileSize, fileOrder, fileType, cb);
		},
		uploadNonPDFStreamAndSave: (fileName: string, fileData: string, fileOrder: number, fileType: string, cb?: Function): Promise<any> => {
			return resolveioServer.call('uploadNonPDFStreamAndSave', fileName, fileData, fileOrder, fileType, cb);
		},
		uploadPDFBufferAndSave: (fileName: string, fileDataBuffer: any, fileSize: number, fileOrder: number, fileType: string, cb?: Function): Promise<any> => {
			return resolveioServer.call('uploadPDFBufferAndSave', fileName, fileDataBuffer, fileSize, fileOrder, fileType, cb);
		},
	};
}
