"use client"

import type { EmailListProps } from "@/components/gmail/email-list/email-list-helpers"
import { useEmailListData } from "@/components/gmail/email-list/hooks/use-email-list-data"
import { useEmailListLabels } from "@/components/gmail/email-list/hooks/use-email-list-labels"
import { useEmailListSelection } from "@/components/gmail/email-list/hooks/use-email-list-selection"
import { useEmailListReading } from "@/components/gmail/email-list/hooks/use-email-list-reading"
import { EmailListLayout } from "@/components/gmail/email-list/email-list-layout"

export function EmailList(props: EmailListProps) {
  const data = useEmailListData(props)
  const labels = useEmailListLabels(data)
  const selection = useEmailListSelection(data, labels)
  const reading = useEmailListReading(props, data, labels)

  return (
    <EmailListLayout
      props={props}
      data={data}
      labels={labels}
      selection={selection}
      reading={reading}
    />
  )
}

export type { EmailListProps } from "@/components/gmail/email-list/email-list-helpers"
