import React from "react";

export default function FileUploadField({
  label,
  multiple = false,
  onChange,
  accept,
  capture,
  hint,
  inputRef
}) {
  return (
    <label className="swi-field">
      <span className="swi-field__label">{label}</span>
      {hint ? <span className="ptw-mgmt-type-format__hint">{hint}</span> : null}
      <input
        ref={inputRef}
        type="file"
        className="swi-input"
        multiple={multiple}
        accept={accept}
        capture={capture}
        onChange={(e) =>
          onChange?.(multiple ? Array.from(e.target.files || []) : e.target.files?.[0] || null)
        }
      />
    </label>
  );
}
