import React from 'react'
import {
    GridCellMemo,
    GridHeader,
    GridHeaderCellMemo,
    GridHeaderRowMemo,
    GridRowMemo,
    GridCellCheckbox,
    GridCellGrabber,
    GridCellTree,
    GridContextActionsMenu,
    GridColumnMenu,
    GridHeaderCellCheckbox,
    GridHeaderCellExpand,
    GridCellLoadingMemo,
    GridCellActionsMenu,
    GridStickyOverlay,
    GridFooterRow,
    GridFooterCell,
    GridDragController,
    GridDragOverlay,
    GridHeaderDragOverlay,
    GridDragIndicator,
    GridHeaderGroupCellMemo,
    GridRangeSelection,
} from '../../functional'

import {
    GridLayout,
    GridHead,
    GridBody,
    GridCellLayout,
    GridCellFocusLayout,
    GridHeaderCellLayout,
    GridHeaderGroupCellLayout,
    GridRowLayout,
    GridHeaderRowLayout,
    GridColumnMoveHandle,
    GridColumnResizeHandle,
    GridEmptyContainer,
    GridContainer,
    GridStickySignal,
    GridFooterRowLayout,
    GridFooter,
    GridFooterCellLayout,
} from '../../layout'
import type { GridComponentsType } from './types'

export const GridComponents: GridComponentsType = {
    GridLayout,
    GridHeadLayout: GridHead,
    GridBody,
    GridFooter,
    GridCell: GridCellMemo,
    GridCellActionsMenu,
    GridCellLoading: GridCellLoadingMemo,
    GridCellLayout,
    GridCellFocusLayout,
    GridCellCheckbox,
    GridCellGrabber,
    GridCellTree,
    GridContextActionsMenu,
    GridColumnMenu,
    GridDragController,
    GridDragOverlay,
    GridDragIndicator,
    GridEmptyContainer,
    GridHeader,
    GridHeaderGroupCell: GridHeaderGroupCellMemo,
    GridHeaderCell: GridHeaderCellMemo,
    GridHeaderGroupCellLayout,
    GridHeaderCellLayout,
    GridHeaderCellCheckbox,
    GridHeaderCellExpand,
    GridHeaderRow: GridHeaderRowMemo,
    GridHeaderRowLayout,
    GridHeaderDragOverlay,
    GridFooterCell,
    GridFooterCellLayout,
    GridFooterRowLayout,
    GridFooterRow,
    GridRangeSelection,
    GridRow: GridRowMemo,
    GridRowLayout,
    GridColumnMoveHandle,
    GridColumnResizeHandle,
    GridStickyOverlay,
    GridStickySignal,
    GridContainer,
}

/**
 * This default context is used by our components to retrieve layout components for
 * use within our components.
 *
 * Use GridComponentsProvider to override these components
 */
export const GridComponentsContext = React.createContext(GridComponents)
