import { ExportButton } from '@bjsdistribution/dms-component-library';
import React from 'react';
import styled from 'styled-components';
import { useAtom, useReturnAfterOrderData } from '../../../order-view/store';
import { filtersReducerReturnAtom } from './ReturnFilterStore';

const TableFilters = () => {
  const [state] = useAtom(filtersReducerReturnAtom);
  const [returnAfterOrder] = useReturnAfterOrderData();

  const { 'x-filters': filters } = state;
  const moduleInfo = {
    isExportedData: returnAfterOrder?.length <= 0 ? false : true,
    moduleName: 'return',
    filter: filters,
    file_type: 'csv',
    apiUrlEndPoint: `v1/return/orders/`,
    reference: 'return_overview_export',
    feature_name: 'return',
  };
  return (
    <Container>
      {' '}
      <ExportButton moduleInfoModule={moduleInfo} />
    </Container>
  );
};
const Container = styled.div`
  display: flex;
  gap: 16px;
  align-items: center;
`;
export default TableFilters;
