import { PdfFile } from '../../types/drawing.ts'
import { MarkConfigDetails} from '../../types/mark.ts'
import PdfPageItem  from './PdfPageItem.tsx';

interface PdfItemProps {
  pdfFile: PdfFile
  markConfigDetails: MarkConfigDetails[]
}

const PdfItem = ({ pdfFile, markConfigDetails }: PdfItemProps) => {
  const filterMarkConfigDetails = (i: number) => {
    return markConfigDetails.filter(
      (details) => details.markLocation.page === i);
  }
  return (
    pdfFile.pages.map((page, i) => {
      console.log('page: ', page);
      return (
        <PdfPageItem
          page={page}
          key={i}
          markConfigDetails={filterMarkConfigDetails(i)}
        />
      )
  }))
}

export default PdfItem