import { CommonProps } from '@/@types/common'
import { Meta } from '@/@types/routes'
import Container from '@/components/shared/Container'
import { useParams, useSearchParams } from 'react-router-dom'
import Pivot from './Pivot'

export interface FormProps extends CommonProps, Meta {
  listFormCode?: string
}

const ListPivot = (props?: FormProps) => {
  const params = useParams()
  const _listFormCode = props?.listFormCode ?? params?.listFormCode ?? ''
  const [searchParams] = useSearchParams()

  return _listFormCode ? (
    <Container>
      <Pivot listFormCode={_listFormCode} searchParams={searchParams} isSubForm={false}></Pivot>
    </Container>
  ) : (
    <></>
  )
}

export default ListPivot
