import { Table as TableComponent } from "./Table";
import { Head } from "./Head";
import { Body } from "./Body";
import { Foot } from "./Foot";
import { Row } from "./Row";
import { HeaderCell } from "./HeaderCell";
import { Cell } from "./Cell";

import type { TableElementType, TableProps, TableRef } from "./Table";
import type {
  HeadProps as TableHeadProps,
  HeadRef as TableHeadRef,
} from "./Head";
import type {
  BodyProps as TableBodyProps,
  BodyRef as TableBodyRef,
} from "./Body";
import type {
  FootProps as TableFootProps,
  FootRef as TableFootRef,
} from "./Foot";
import type { RowProps as TableRowProps, RowRef as TableRowRef } from "./Row";
import type {
  HeaderCellProps as TableHeaderCellProps,
  HeaderCellRef as TableHeaderCellRef,
} from "./HeaderCell";
import type {
  CellProps as TableCellProps,
  CellRef as TableCellRef,
} from "./Cell";

export interface TableCompound extends React.FC<TableProps> {
  Head: React.FC<TableHeadProps>;
  Body: React.FC<TableBodyProps>;
  Foot: React.FC<TableFootProps>;
  Row: React.FC<TableRowProps>;
  HeaderCell: React.FC<TableHeaderCellProps>;
  Cell: React.FC<TableCellProps>;
}

const Table: TableCompound = Object.assign(TableComponent, {
  Head,
  Body,
  Foot,
  Row,
  HeaderCell,
  Cell,
});

export type {
  TableElementType,
  TableProps,
  TableRef,
  TableHeadProps,
  TableHeadRef,
  TableBodyProps,
  TableBodyRef,
  TableFootProps,
  TableFootRef,
  TableRowProps,
  TableRowRef,
  TableHeaderCellProps,
  TableHeaderCellRef,
  TableCellProps,
  TableCellRef,
};

Table.displayName = "Table";
export { Table };
