/**
 * @fileoverview Duplicate Detection Kanban Board Resource Component
 *
 * Dashboard resource for reviewing duplicate detection results in a Kanban-style
 * board with three columns: Pending Review, Approved, and Rejected.
 * Loads data from MJ: Duplicate Runs, MJ: Duplicate Run Details, and
 * MJ: Duplicate Run Detail Matches entities.
 */
import { OnDestroy, AfterViewInit } from '@angular/core';
import { ResourceData, MJDuplicateRunEntity, MJDuplicateRunDetailEntity, MJDuplicateRunDetailMatchEntity } from '@memberjunction/core-entities';
import { BaseResourceComponent } from '@memberjunction/ng-shared';
import * as i0 from "@angular/core";
/**
 * Represents a group of duplicate matches for a single source record,
 * aggregated from detail and match entities for display on the Kanban board.
 */
interface DuplicateGroup {
    DetailId: string;
    RunId: string;
    RecordId: string;
    EntityName: string;
    ApprovalStatus: 'Pending' | 'Approved' | 'Rejected';
    MatchCount: number;
    HighestScore: number;
    Matches: MJDuplicateRunDetailMatchEntity[];
    MatchedAt: Date;
}
interface DuplicateFilter {
    EntityName: string;
    MinScore: number;
    MaxScore: number;
    DateFrom: string;
    DateTo: string;
}
export declare class DuplicateDetectionResourceComponent extends BaseResourceComponent implements AfterViewInit, OnDestroy {
    private cdr;
    private destroy$;
    private filterSubject;
    IsLoading: boolean;
    IsSaving: boolean;
    Runs: MJDuplicateRunEntity[];
    Details: MJDuplicateRunDetailEntity[];
    Matches: MJDuplicateRunDetailMatchEntity[];
    AllGroups: DuplicateGroup[];
    PendingGroups: DuplicateGroup[];
    ApprovedGroups: DuplicateGroup[];
    RejectedGroups: DuplicateGroup[];
    Filters: DuplicateFilter;
    EntityNames: string[];
    /** Whether this component is embedded inside the Knowledge Hub shell */
    EmbeddedMode: boolean;
    /** View mode: 'kanban' (card board) or 'table' (paged grid) */
    DisplayMode: 'kanban' | 'table';
    /** Page size for table view */
    PageSize: number;
    /** Current page (0-based) */
    CurrentPage: number;
    /** Selected entity filter */
    SelectedEntityFilter: string;
    /** Currently selected group for merge panel */
    SelectedMergeGroup: DuplicateGroup | null;
    /** Whether the merge panel is visible */
    ShowMergePanel: boolean;
    /** Auto-switch to table mode when groups exceed threshold */
    private readonly kanbanThreshold;
    /** Toggle display mode */
    ToggleDisplayMode(): void;
    /** Filter by entity name */
    FilterByEntity(entityName: string): void;
    /** Get paged groups for table view */
    GetPagedGroups(): DuplicateGroup[];
    /** Get total page count */
    get TotalPages(): number;
    /** Navigate to next page */
    NextPage(): void;
    /** Navigate to previous page */
    PrevPage(): void;
    /** Open the merge panel for a duplicate group */
    OpenMergePanel(group: DuplicateGroup): void;
    /** Close the merge panel */
    CloseMergePanel(): void;
    /** Auto-select display mode based on group count */
    private autoSelectDisplayMode;
    get TotalGroupCount(): number;
    get PendingCount(): number;
    get ApprovedCount(): number;
    get RejectedCount(): number;
    ngAfterViewInit(): Promise<void>;
    ngOnDestroy(): void;
    GetResourceDisplayName(_data: ResourceData): Promise<string>;
    GetResourceIconClass(_data: ResourceData): Promise<string>;
    /**
     * Loads all duplicate run data and builds the Kanban groups.
     */
    LoadData(): Promise<void>;
    /**
     * Approves all matches within a duplicate group by updating each match's ApprovalStatus.
     */
    ApproveMatch(group: DuplicateGroup): Promise<void>;
    /**
     * Rejects all matches within a duplicate group by updating each match's ApprovalStatus.
     */
    RejectMatch(group: DuplicateGroup): Promise<void>;
    /** Handle filter changes with debounce */
    OnFilterChange(): void;
    /** Clear all filters */
    ClearFilters(): void;
    /** Returns the CSS class for a match score indicator */
    GetScoreClass(score: number): string;
    /** Returns a human-readable label for a match score */
    GetScoreLabel(score: number): string;
    /** Format a date for display */
    FormatDate(date: Date | null): string;
    /** Whether any filters are active */
    get HasActiveFilters(): boolean;
    private setupFilterDebounce;
    /** Extract unique entity names from loaded runs */
    private extractEntityNames;
    /**
     * Build DuplicateGroup objects by joining details to their matches,
     * and resolving the entity name from the parent run.
     */
    private buildGroups;
    /** Find the highest match probability across a set of matches */
    private computeHighestScore;
    /**
     * Determine the dominant approval status for a group of matches.
     * If any match is Pending, the group is Pending.
     * Otherwise, if all are Approved, the group is Approved.
     * If all are Rejected, the group is Rejected.
     * Mixed Approved/Rejected defaults to Pending.
     */
    private computeDominantApprovalStatus;
    /** Find the latest MatchedAt date across a set of matches */
    private computeLatestMatchDate;
    /** Apply filters and distribute groups into Kanban columns */
    private applyFilters;
    /** Update the ApprovalStatus of all matches within a group and re-sort.
     *  Since this.Matches already contains entity_object instances, we update and save them directly
     *  instead of loading each one individually from the database.
     */
    private updateGroupApprovalStatus;
    static ɵfac: i0.ɵɵFactoryDeclaration<DuplicateDetectionResourceComponent, never>;
    static ɵcmp: i0.ɵɵComponentDeclaration<DuplicateDetectionResourceComponent, "app-duplicate-detection-resource", never, { "EmbeddedMode": { "alias": "EmbeddedMode"; "required": false; }; }, {}, never, never, false, never>;
}
export declare function LoadDuplicateDetectionResource(): void;
export {};
//# sourceMappingURL=duplicate-detection-resource.component.d.ts.map