import { createElement, Fragment } from "react";
import { SugaredField } from "@contember/binding";
const getGenericFileMetadataExtractor = ({ fileNameField, fileSizeField, fileTypeField, lastModifiedField }) => ({
  staticRender: () => /* @__PURE__ */ createElement(Fragment, null, !!fileNameField && /* @__PURE__ */ createElement(SugaredField, {
    field: fileNameField
  }), !!fileSizeField && /* @__PURE__ */ createElement(SugaredField, {
    field: fileSizeField
  }), !!fileTypeField && /* @__PURE__ */ createElement(SugaredField, {
    field: fileTypeField
  }), !!lastModifiedField && /* @__PURE__ */ createElement(SugaredField, {
    field: lastModifiedField
  })),
  populateFields: ({ entity, file }) => {
    entity.batchUpdates((getAccessor) => {
      fileNameField && getAccessor().getField(fileNameField).updateValue(file.name);
      fileSizeField && getAccessor().getField(fileSizeField).updateValue(file.size);
      fileTypeField && getAccessor().getField(fileTypeField).updateValue(file.type);
      lastModifiedField && getAccessor().getField(lastModifiedField).updateValue(file.lastModified);
    });
  }
});
export { getGenericFileMetadataExtractor };
//# sourceMappingURL=getGenericFileMetadataExtractor.js.map
