import { RefObject } from 'react';
import { VariableSizeList as List } from 'react-window';
import { AccountBase, AuthParams, COTTransactionTrackingByTransactionId, ClassBase, CustomerBase, Entity, ExpenseAutomationTransactionViewSelector, ExpenseAutomationTransactionsTab, ExpenseAutomationTransactionsViewUIState, ID, MonthYearPeriod, PageToken, ProjectBase, RecommendationWithCOT, SupportedTransactionWithCOT, TransactionID, TransactionReviewLocalDataSelectorView, TransactionType, VendorBase } from '@zeniai/client-epic-state';
import { TransactionCategorizationCOTTrackingProps } from '../../../../types/cotTracking';
import { AutoCompleteActions, AutoCompleteData } from '../../../common/autoComplete/autoCompleteProps';
import { AutoCompleteGroupedOption } from '../../../formElements/autoCompleteGroupedSingleSelectField/AutoCompleteGroupedSingleSelectField';
import { FormSectionProps } from '../../../formElements/common/formSection';
import { FooterFormIdType } from '../../common';
import { ExpenseAutomationRowCommenting } from '../../components/useExpenseAutomationRowCommenting';
export interface TransactionCategorizationActionProps {
    /**
     * Statsig `is_create_transfer_entry_from_expense_enabled`. Controls whether the
     * TC list row renders an interactive type dropdown (true) or just the type pill (false).
     */
    isCreateTransferEntryFromExpenseEnabled?: boolean;
    onFetchRecommendationsForEntityCategorization: (amount: number, transactionDetails: {
        lineIds: ID[];
        transaction: SupportedTransactionWithCOT;
        transactionId: TransactionID;
    }, isBulkFetch: boolean, selectedTab: ExpenseAutomationTransactionsTab, entity?: Entity, updatedVendor?: VendorBase, isUncategorizedExpenseCategoryEnabled?: boolean) => void;
    onFetchRecommendationsForEntityCategorizationWithCustomer: (amount: number, transactionDetails: {
        lineIds: ID[];
        transaction: SupportedTransactionWithCOT;
        transactionId: TransactionID;
    }, isBulkFetch: boolean, selectedTab: ExpenseAutomationTransactionsTab, entity?: Entity, updatedCustomer?: CustomerBase, isUncategorizedExpenseCategoryEnabled?: boolean) => void;
    onFetchTransactionCategorizationList: (currentTab: ExpenseAutomationTransactionsTab, searchString?: string, keepExistingListItems?: boolean, pageToken?: PageToken, refreshInBackground?: boolean, resetListItems?: boolean, isUncategorizedExpenseCategoryEnabled?: boolean) => void;
    onSaveUpdateTransactionCategorization: (selectedTab: ExpenseAutomationTransactionsTab, transactionsIds: ID[], cotTrackingByTransactionId: COTTransactionTrackingByTransactionId) => void;
    onTransactionCategorizationRowClick: (transactionId: ID, transactionType: TransactionType) => void;
    onUpdateScrollYOffSetTransactionCategorizationUIState: (selectedTab: ExpenseAutomationTransactionsTab, uiState: Partial<ExpenseAutomationTransactionsViewUIState>) => void;
    onUpdateSelectedCheckboxTransactionIds: (selectedTab: ExpenseAutomationTransactionsTab, transactionIds: ID[]) => void;
    onUpdateTransactionCategorizationUIState: (selectedTab: ExpenseAutomationTransactionsTab, uiState: Partial<ExpenseAutomationTransactionsViewUIState>) => void;
    onUploadTransactionReceipt: (selectedTab: ExpenseAutomationTransactionsTab, transactionId: ID, transactionType: string, files: Blob[], fileNames: string[]) => void;
    resetTransactionCategorizationLocalData: (selectedTab: ExpenseAutomationTransactionsTab, transactionIds: ID[], selectedPeriod: MonthYearPeriod, keepExistingData: boolean, totalCount: number, lineItemsByTransactionIds: Record<ID, string[]>, isUncategorizedExpenseCategoryEnabled?: boolean, pageToken?: PageToken) => void;
    setActivityLogTransactionId: (transactionId: ID | undefined) => void;
    setCurrentFooterFormId: (formId: FooterFormIdType) => void;
    setLocalDataForCategoryAndClass: (selectedTab: ExpenseAutomationTransactionsTab, transactionId: ID, lineId: ID, transactions: SupportedTransactionWithCOT[], vendorId?: ID, customerId?: ID, selectedAccount?: AccountBase, selectedClassBase?: ClassBase, selectedVendor?: Entity, recommendations?: RecommendationWithCOT[], isUncategorizedExpenseCategoryEnabled?: boolean, isAccountingClassesEnabled?: boolean, selectedProjectBase?: ProjectBase) => void;
    updateSelectedVendorForTransaction: (selectedTab: ExpenseAutomationTransactionsTab, transactionId: ID, lineId: ID, selectedTransaction: SupportedTransactionWithCOT, updatedVendor?: VendorBase) => void;
    /** Host-owned inline transfer rail (Expense Automation TC); list opens via callback. */
    onOpenTransferRightPanel?: (data: TransferDrawerTransactionData) => void;
}
export interface TransactionActionProps {
    lineItemId?: ID;
    transactionId?: ID;
}
/**
 * List/detail API fields for transfer flows. Declared locally so web-components
 * stays compatible when `@zeniai/client-epic-state` `Transaction` typings lag the runtime model.
 */
export type TransactionTransferAccountApiFields = {
    accountIntegrationId?: string;
    qboAccountId?: string;
    qboAccountName?: string;
};
export interface TransferDrawerTransactionData {
    amount: {
        amount: number;
        currencyCode: string;
        currencySymbol: string;
    };
    category: string;
    className: string;
    /**
     * List: `account_integration_id`. Detail: `qbo_account_id` (same prop for drawer prefill).
     */
    debitAccountIntegrationId: string;
    /** List: `account_name` (line account). Detail: `qbo_account_name`. */
    debitAccountName: string;
    memo: string;
    payee: string;
    sourceTransactionType: string;
    transactionId: ID;
    transactionType: string;
}
export interface CreateTransferPayload {
    creditAccountIntegrationId: string;
    debitAccountIntegrationId: string;
    memo: string;
    sourceTransactionType: string;
    transactionId: ID;
    transactionType: string;
}
export interface TransactionCategorizationListRowActionProps {
    /**
     * Statsig `is_create_transfer_entry_from_expense_enabled`. When false the row
     * renders only the type pill; when true the type dropdown is interactive on
     * accounts that allow Transfer/Credit-card payment.
     */
    isCreateTransferEntryFromExpenseEnabled?: boolean;
    onTransactionCategorizationRowClick: (transactionId: ID, transactionType: TransactionType) => void;
    setCurrentTransactionInAction: (transaction: Partial<TransactionActionProps>) => void;
    vendorLoadOptions: (inputValue: string, callback: (allOptions: AutoCompleteGroupedOption[]) => void) => void;
    onOpenTransferDrawer?: (data: TransferDrawerTransactionData) => void;
}
export interface TransactionCategorizationListRowProps extends TransactionCategorizationListRowActionProps, FormSectionProps {
    authParams: AuthParams;
    containerRef: RefObject<HTMLDivElement>;
    isAccountingClassesEnabled: boolean;
    isCOTEnabled: boolean;
    isPanelSelected: boolean;
    listContainerRef: RefObject<List | null>;
    /** Row commenting state; owned by the virtual list row in full layout so the rail can sit outside the scrolling content column. */
    rowCommenting: ExpenseAutomationRowCommenting;
    selectedTab: ExpenseAutomationTransactionsTab;
    showProjectField: boolean;
    transaction: TransactionReviewLocalDataSelectorView;
    transactionView: ExpenseAutomationTransactionViewSelector;
    vendorSearchAutoCompleteActions: AutoCompleteActions;
    vendorSearchAutoCompleteData: AutoCompleteData;
    cotTracking?: TransactionCategorizationCOTTrackingProps;
    isUncategorizedExpenseCategoryEnabled?: boolean;
    openTooltipId?: ID;
    onUploadTransactionReceipt: (selectedTab: ExpenseAutomationTransactionsTab, transactionId: ID, transactionType: string, files: Blob[], fileNames: string[]) => void;
    setActivityLogTransactionId: (transactionId: ID | undefined) => void;
    setOpenTooltipId: (tooltipId: ID | undefined) => void;
}
export interface TransactionCategorizationListTableActionProps extends TransactionCategorizationListRowActionProps {
    isCOTEnabled: boolean;
    onFetchTransactionCategorizationList: (selectedTab: ExpenseAutomationTransactionsTab, searchString?: string, keepExistingListItems?: boolean, pageToken?: PageToken, refreshInBackground?: boolean, resetListItems?: boolean) => void;
    onUpdateScrollYOffSetTransactionCategorizationUIState: (selectedTab: ExpenseAutomationTransactionsTab, uiState: Partial<ExpenseAutomationTransactionsViewUIState>) => void;
    onUpdateTransactionCategorizationUIState: (selectedTab: ExpenseAutomationTransactionsTab, uiState: Partial<ExpenseAutomationTransactionsViewUIState>) => void;
    onUploadTransactionReceipt: (selectedTab: ExpenseAutomationTransactionsTab, transactionId: ID, transactionType: string, files: Blob[], fileNames: string[]) => void;
    setCurrentTransactionInAction: (transaction: Partial<TransactionActionProps>) => void;
    vendorLoadOptions: (inputValue: string, callback: (allOptions: AutoCompleteGroupedOption[]) => void) => void;
}
export interface TransactionCategorizationPageProps extends TransactionCategorizationActionProps {
    authParams: AuthParams;
    isAccountingClassesEnabled: boolean;
    isCOTEnabled: boolean;
    isProjectsTransactionsEnabled: boolean;
    isTransactionActivityEnabled: boolean;
    sectionId: string;
    selectedPeriod: MonthYearPeriod;
    selectedTab: ExpenseAutomationTransactionsTab;
    transactionView: ExpenseAutomationTransactionViewSelector;
    vendorSearchAutoCompleteActions: AutoCompleteActions;
    vendorSearchAutoCompleteData: AutoCompleteData;
    onUploadTransactionReceipt: (selectedTab: ExpenseAutomationTransactionsTab, transactionId: ID, transactionType: string, files: Blob[], fileNames: string[]) => void;
    setActivityLogTransactionId: (transactionId: ID | undefined) => void;
}
