'use client'

import { Checkout, Repository, User } from '@/payload-types'
import { PaginatedDocs } from 'payload'
import RepoList from './RepoList'
import HoldRequestNotifications from './HoldRequests'
import BorrowedBooks from './BorrowedBooks'

type Props = {
  repos: PaginatedDocs<Repository> | null
  borrows: PaginatedDocs<Checkout> | null
  user: User | null
}
const Manage = (props: Props) => {
  const { repos, borrows, user } = props

  return (
    <section>
      <div className="my-6">
        <RepoList repos={repos} />
      </div>

      <div>{user && <HoldRequestNotifications repos={repos} user={user} />}</div>

      <div>
        <BorrowedBooks initialBorrows={borrows} />
      </div>
    </section>
  )
}

export default Manage
