import { OnInit, OnDestroy } from '@angular/core';
import { BaseResourceComponent } from '@memberjunction/ng-shared';
import { ResourceData } from '@memberjunction/core-entities';
import { IntegrationSummary, EntityMapRow } from '../../services/integration-data.service';
import * as i0 from "@angular/core";
interface PipelineCard {
    IntegrationID: string;
    IntegrationName: string;
    Icon: string;
    StatusColor: string;
    StatusLabel: string;
    EntityMapCount: number;
    ActiveMapCount: number;
    UniqueEntityCount: number;
    LastSync: string;
    IsExpanded: boolean;
    EntityMaps: EntityMapRow[];
    /** Filtered subset currently visible */
    FilteredMaps: EntityMapRow[];
    SearchTerm: string;
}
type TransformType = 'direct' | 'regex' | 'split' | 'combine' | 'lookup' | 'format' | 'coerce' | 'substring' | 'custom';
interface TransformStepUI {
    Type: TransformType;
    Config: Record<string, unknown>;
    OnError: 'Skip' | 'Null' | 'Fail';
}
interface VisualSourceField {
    Name: string;
    Label: string;
    Type: string;
    IsRequired: boolean;
    IsPrimaryKey: boolean;
}
interface VisualDestField {
    Name: string;
    Type: string;
    IsRequired: boolean;
}
interface VisualConnection {
    ID: string | null;
    SourceFieldName: string;
    DestFieldName: string;
    IsKeyField: boolean;
    IsRequired: boolean;
    Direction: 'SourceToDest' | 'DestToSource' | 'Both';
    TransformSteps: TransformStepUI[];
    IsDirty: boolean;
    IsNew: boolean;
    MarkedForDelete: boolean;
}
export declare class PipelinesComponent extends BaseResourceComponent implements OnInit, OnDestroy {
    PipelineCards: PipelineCard[];
    IsLoading: boolean;
    GlobalSearch: string;
    VisualEditorOpen: boolean;
    EditorEntityMap: EntityMapRow | null;
    EditorCard: PipelineCard | null;
    EditorSourceFields: VisualSourceField[];
    EditorDestFields: VisualDestField[];
    EditorConnections: VisualConnection[];
    EditorLoading: boolean;
    EditorSaving: boolean;
    EditorSaveSuccess: boolean;
    /** Schema pipeline state */
    IsRunningPipeline: boolean;
    PipelineResultMessage: string | null;
    PipelineResultSuccess: boolean;
    /** Currently selected connection index (opens transform panel) */
    SelectedConnectionIdx: number | null;
    /** When non-null, user is in "connect mode" — next dest click creates a mapping */
    ConnectingFromSource: string | null;
    /** Search/filter within the visual editor columns */
    EditorSearchSource: string;
    EditorSearchDest: string;
    /** Data preview state */
    ShowSourcePreview: boolean;
    ShowDestPreview: boolean;
    PreviewSourceLoading: boolean;
    PreviewDestLoading: boolean;
    PreviewSourceRows: Array<Record<string, string | number | boolean | null>>;
    PreviewDestRows: Array<Record<string, string | number | boolean | null>>;
    PreviewSourceColumns: string[];
    PreviewDestColumns: string[];
    /** Collapsible section state */
    FieldMapsExpanded: boolean;
    InfoPanelExpanded: boolean;
    /** Info panel data */
    InfoPanelLoading: boolean;
    InfoDestRecordCount: number | null;
    InfoLastSync: {
        StartedAt: string | null;
        EndedAt: string | null;
        Status: string;
        TotalRecords: number;
    } | null;
    /** SVG layout constants */
    readonly FIELD_HEIGHT = 40;
    readonly SVG_WIDTH = 200;
    /** Transform type metadata */
    readonly TRANSFORM_TYPES: Array<{
        Value: TransformType;
        Label: string;
        Icon: string;
    }>;
    private dataService;
    private cdr;
    ngOnInit(): Promise<void>;
    ngOnDestroy(): void;
    GetResourceDisplayName(_data: ResourceData): Promise<string>;
    GetResourceIconClass(_data: ResourceData): Promise<string>;
    LoadData(): Promise<void>;
    BuildCards(summaries: IntegrationSummary[], allEntityMaps: EntityMapRow[]): void;
    ToggleCard(card: PipelineCard): void;
    ExpandAll(): void;
    CollapseAll(): void;
    OnCardSearch(card: PipelineCard, event: Event): void;
    OnGlobalSearchChange(event: Event): void;
    /** Bridge for <mj-page-search> which emits a plain string. */
    OnGlobalSearchValue(value: string): void;
    get FilteredCards(): PipelineCard[];
    OnMapRowClick(card: PipelineCard, entityMap: EntityMapRow): void;
    OnToggleSyncEnabled(card: PipelineCard, em: EntityMapRow, event: Event): Promise<void>;
    OnToggleEditorSyncEnabled(event: Event): Promise<void>;
    ToggleSourcePreview(): Promise<void>;
    ToggleDestPreview(): Promise<void>;
    private loadSourcePreview;
    private loadDestPreview;
    ToggleFieldMaps(): void;
    ToggleInfoPanel(): void;
    private loadInfoPanelData;
    FormatSyncDate(dateStr: string | null): string;
    SyncStatusClass(status: string): string;
    /**
     * Direction arrows for entity-level sync direction.
     * Pull = data flows FROM external source INTO MJ = right arrow (→)
     * Push = data flows FROM MJ OUT to external = left arrow (←)
     */
    DirectionLabel(direction: string): string;
    DirectionBadgeClass(direction: string): string;
    DirectionText(direction: string): string;
    get IntegrationCount(): number;
    get TotalMapCount(): number;
    OpenVisualEditor(card: PipelineCard, entityMap: EntityMapRow): void;
    CloseVisualEditor(): void;
    LoadVisualEditorData(): Promise<void>;
    get FilteredEditorSourceFields(): VisualSourceField[];
    get FilteredEditorDestFields(): VisualDestField[];
    /** Only show connections where both source and dest are visible */
    get VisibleConnections(): VisualConnection[];
    get EditorCanvasHeight(): number;
    GetConnectionPath(conn: VisualConnection): string;
    GetConnectionMidY(conn: VisualConnection): number;
    GetConnectionLineClass(conn: VisualConnection): string;
    GetConnectionBadgeClass(conn: VisualConnection): string;
    GetConnectionTransformIcon(conn: VisualConnection): string;
    /** Direction-aware icon for the SVG connection badge */
    GetConnectionDirectionIcon(conn: VisualConnection): string;
    GetTransformTypeLabel(type: TransformType): string;
    IsSourceFieldMapped(fieldName: string): boolean;
    IsDestFieldMapped(fieldName: string): boolean;
    OnEditorSourceClick(fieldName: string): void;
    OnEditorDestClick(fieldName: string): void;
    CancelConnect(): void;
    SelectConnection(index: number, event: Event): void;
    DeselectConnection(): void;
    get SelectedConnection(): VisualConnection | null;
    RemoveSelectedConnection(): void;
    ToggleConnectionKey(): void;
    ToggleConnectionRequired(): void;
    GetDirectionArrowClass(direction: string): string;
    OnConnectionDirectionChange(direction: 'SourceToDest' | 'DestToSource' | 'Both'): void;
    OnConnectionTransformChange(stepIndex: number, type: TransformType): void;
    OnTransformConfigChange(conn: VisualConnection, stepIndex: number, key: string, value: string): void;
    AddTransformStep(): void;
    RemoveTransformStep(stepIndex: number): void;
    get HasEditorChanges(): boolean;
    RunSchemaPipeline(): Promise<void>;
    SaveVisualEditor(): Promise<void>;
    AutoMapEditorFields(): Promise<void>;
    get EditorMappedCount(): number;
    get EditorKeyFieldCount(): number;
    get EditorRequiredCount(): number;
    /** Get transform config keys for inline editing */
    GetConfigKeys(step: TransformStepUI): string[];
    GetConfigValue(step: TransformStepUI, key: string): string;
    private getSourceFieldIndex;
    private getDestFieldIndex;
    private getSourceFieldY;
    private getDestFieldY;
    private getPrimaryTransformType;
    private parseTransformPipeline;
    private serializeTransformPipeline;
    private getDefaultConfigForType;
    /**
     * Resolve source fields from IntegrationObjectField metadata via IntegrationEngineBase.
     * CompanyIntegrationID → Integration → IntegrationObject → IntegrationObjectFields.
     */
    private resolveSourceFieldsFromMetadata;
    private applyMapFilter;
    private loadAllEntityMaps;
    private resolveIcon;
    private statusToColor;
    private statusToLabel;
    static ɵfac: i0.ɵɵFactoryDeclaration<PipelinesComponent, never>;
    static ɵcmp: i0.ɵɵComponentDeclaration<PipelinesComponent, "app-integration-pipelines", never, {}, {}, never, never, false, never>;
}
export declare function LoadPipelinesComponent(): void;
export {};
//# sourceMappingURL=pipelines.component.d.ts.map