import { LinkField } from '@hubspot/cms-components/fields';
import { ContentFieldsProps } from './types.js';

const ContentFields = <TLinkName extends string = 'link'>({
  linkLabel = 'Link',
  linkName = 'link',
  linkDefault = {
    url: {
      type: 'EXTERNAL',
      content_id: null,
      href: 'https://www.hubspot.com',
    },
  },
  fieldVisibility,
}: ContentFieldsProps<TLinkName>) => {
  return (
    <LinkField
      label={linkLabel}
      name={linkName}
      visibility={fieldVisibility?.[linkName]}
      default={linkDefault}
    />
  );
};

export default ContentFields;
