import { itemLabel } from "@ax/constants";
import type { IBulkSelectedItems } from "@ax/hooks";
import type { IBulkAction } from "@ax/types";

import GridHeader from "./GridHeader";

import * as S from "./style";

const BulkGridHeader = (props: IBulkHeaderProps): JSX.Element => {
	const { showBulk, checkState, selectItems, selectAllItems, totalItems, bulkActions, selectedItems, isLoading } =
		props;

	return showBulk ? (
		<S.BulkWrapper>
			<S.StyledBulkSelectionOptions
				isScrolling={false}
				checkState={checkState}
				actions={bulkActions}
				selectItems={selectItems}
				totalItems={totalItems}
				selectedItems={selectedItems}
				isLoading={isLoading}
				itemLabel={itemLabel.IMAGE}
			/>
		</S.BulkWrapper>
	) : (
		<GridHeader selectAllItems={selectAllItems} checkState={checkState} totalItems={totalItems} />
	);
};

export interface IBulkHeaderProps {
	showBulk: boolean;
	checkState: any;
	selectItems: () => void;
	selectAllItems: () => void;
	totalItems: number;
	bulkActions: IBulkAction[];
	selectedItems: IBulkSelectedItems;
	isLoading: boolean;
}

export default BulkGridHeader;
