/* eslint-disable @typescript-eslint/no-explicit-any */
import { TailwindPlayCommonParams } from '@/TailwindPlay/Fields/types.js';
import { InvalidField } from '@/TailwindPlay/Fields/Invalid.js';
import { extractHusarData } from '@/TailwindPlay/shared/extract.js';

export const FieldS3Image: React.FC<TailwindPlayCommonParams> = (props) => {
  const { v, attributes } = extractHusarData(props);
  if (typeof v !== 'object' && v !== null && typeof v !== 'undefined') return <InvalidField />;

  return <img src={v?.url} {...attributes} />;
};
