import { useSelector } from 'react-redux';

import {
  excludeVideoIdsSelector,
  isSelectedAllSelector,
  videoIdsSelector,
} from '@/modules/editorial/bulkActions/redux/selectors';
import { totalCountSelector } from '@/modules/editorial/editorialSearchResults/redux/selectors';

export default function useGetSelectedVideo() {
  const isSelectedAll = useSelector(isSelectedAllSelector);
  const videoIds = useSelector(videoIdsSelector);
  const totalCount = useSelector(totalCountSelector);
  const excludeVideoIds = useSelector(excludeVideoIdsSelector);
  return isSelectedAll ? totalCount - excludeVideoIds.length : videoIds.length;
}
