"use client"

import type { FieldValues, FieldPath } from "react-hook-form"
import { RhfField } from "../rhf-field"
import { TimePickerField, type TimePickerFieldProps } from "../controls/time-picker-field"
import type { BaseFieldControlProps } from "../types"

type RhfTimeFieldProps<
    TValues extends FieldValues,
    TName extends FieldPath<TValues>,
> = {
    name: TName
    label?: string
    description?: string
    required?: boolean
    disabled?: boolean
} & Omit<TimePickerFieldProps, keyof BaseFieldControlProps<string>>

export function RhfTimeField<
    TValues extends FieldValues,
    TName extends FieldPath<TValues>,
>(props: RhfTimeFieldProps<TValues, TName>) {
    return <RhfField  {...props} component={TimePickerField} />
}
