'use client';

import { Input } from '@/components/ui/input';
import type { FieldConfig } from '@/types/invyone-component';

interface TimeFieldProps {
  field: FieldConfig;
  value: any;
  onChange: (value: any) => void;
  mode: 'form' | 'search';
  disabled?: boolean;
  error?: string;
}

/**
 * type='time' 전용 — HH:mm (또는 HH:mm:ss) 단일 시각.
 * form / search 모드 동일 (단일 time 입력).
 */
export function TimeField({ value, onChange, disabled, error }: TimeFieldProps) {
  return (
    <Input
      type="time"
      value={value ?? ''}
      onChange={(e) => onChange(e.target.value || null)}
      disabled={disabled}
      className={`h-7 text-xs ${error ? 'border-destructive' : ''}`}
    />
  );
}
