import { ModuleRef } from "@nestjs/core";
import { EntityManager } from 'typeorm';
import { CRUDService } from '../services/crud.service';
import { HttpService } from '@nestjs/axios';
import { ImportInstructionsResponseDto } from '../dtos/import-instructions.dto';
import { ImportTransactionErrorLog } from '../entities/import-transaction-error-log.entity';
import { ImportTransactionRepository } from '../repository/import-transaction.repository';
import { ImportTransaction } from '../entities/import-transaction.entity';
import { CsvService } from './csv.service';
import { ExcelService } from './excel.service';
import { SolidIntrospectService } from './solid-introspect.service';
import { ModelMetadataHelperService } from '../helpers/model-metadata-helper.service';
import { ActiveUserData } from '../interfaces/active-user-data.interface';
interface ImportTemplateFileInfo {
    stream: NodeJS.ReadableStream;
    fileName: string;
    mimeType: string;
}
export declare enum ImportFormat {
    CSV = "csv",
    EXCEL = "excel"
}
export declare enum ImportMimeTypes {
    CSV = "text/csv",
    EXCEL = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
}
export interface ImportMappingInfo {
    sampleImportedRecordInfo: SampleImportedRecordInfo[];
    importableFields: ImportableFieldInfo[];
}
export interface SampleImportedRecordInfo {
    cellHeader: string;
    cellValue: string;
    defaultMappedFieldName: string;
}
export interface ImportableFieldInfo {
    name: string;
    displayName: string;
}
export interface ImportPaginatedReadResult {
    headers: string[];
    data: Record<string, any>[];
}
export declare enum ImportTransactionStatus {
    draft = "draft",
    mapping_created = "mapping_created",
    import_started = "import_started",
    import_succeeded = "import_succeeded",
    import_failed = "import_failed"
}
export interface ImportSyncResult {
    status: string;
    importedIds: Array<number>;
    importedCount: number;
    failedCount: number;
}
export declare class ImportTransactionService extends CRUDService<ImportTransaction> {
    readonly entityManager: EntityManager;
    readonly repo: ImportTransactionRepository;
    readonly moduleRef: ModuleRef;
    readonly excelService: ExcelService;
    readonly csvService: CsvService;
    readonly httpService: HttpService;
    readonly introspectService: SolidIntrospectService;
    private readonly modelMetadataHelperService;
    constructor(entityManager: EntityManager, repo: ImportTransactionRepository, moduleRef: ModuleRef, excelService: ExcelService, csvService: CsvService, httpService: HttpService, introspectService: SolidIntrospectService, modelMetadataHelperService: ModelMetadataHelperService);
    private readonly logger;
    getImportTemplate(modelMetadataId: number, format?: ImportFormat): Promise<ImportTemplateFileInfo>;
    getImportInstructions(modelMetadataId: number): Promise<ImportInstructionsResponseDto>;
    getImportMappingInfo(importTransactionId: number): Promise<ImportMappingInfo>;
    startImportSync(importTransactionId: number, activeUser: ActiveUserData): Promise<ImportSyncResult>;
    startImportAsync(importTransactionId: number): Promise<void>;
    exportFailedImportedImports(importTransactionId: number): Promise<{
        stream: any;
        fileName: string;
        mimeType: ImportMimeTypes;
    }>;
    private getFailedRecordsStream;
    private loadImportTransaction;
    private fieldsAllowedForImport;
    private getFileRecordsSample;
    private getImportFileObject;
    private getImportFileStream;
    private importFromFileToDB;
    private importRecords;
    createErrorLogEntry(importTransaction: ImportTransaction, record: Record<string, any>, error: any): Promise<ImportTransactionErrorLog>;
    private insertRecord;
    private getModelService;
    private convertImportedRecordToDto;
    private populateDtoForACell;
    private populateDtoForSelectionValues;
    private populateDtoForBoolean;
    private populateDtoForNumber;
    private populateDtoForDate;
    private populateDtoForRelations;
    private getRelatedEntityIdsFromUserKeys;
}
export {};
//# sourceMappingURL=import-transaction.service.d.ts.map