/* eslint-disable react/no-danger, react/no-unknown-property, react/require-default-props */
import React from 'react';
import PropTypes from 'prop-types';
import useFrames from "../../../hooks/useFrames/index.js";
import useUtagSetup from "../../../hooks/tracking/useUtagSetup/index.js";
import HeadMeta from './HeadMeta';
import HeadSocial from './HeadSocial';
import HeadCompliance from './HeadCompliance';
import useHeadSlots from './useHeadSlots';
const Head = function Head({
  embed = false,
  customNodes = [],
  children,
  ...forwardProps
} = {}) {
  const props = {
    embed,
    ...forwardProps
  };
  useFrames({
    activate: embed
  });
  useUtagSetup(props);
  const slots = useHeadSlots(customNodes, children);
  return <>
      {slots.before.map(s => s)}
      <HeadMeta {...props} />
      {slots.afterMeta.map(s => s)}
      <HeadSocial {...props} />
      {slots.afterSocial.map(s => s)}
      <HeadCompliance {...props} />
      {slots.afterCompliance.map(s => s)}
    </>;
};
Head.propTypes = {
  embed: PropTypes.bool,
  children: PropTypes.oneOfType([PropTypes.node, PropTypes.arrayOf(PropTypes.node)]),
  seo: PropTypes.shape({
    title: PropTypes.string,
    description: PropTypes.string
  }),
  utag: PropTypes.shape({
    pageName: PropTypes.string
  }),
  social: PropTypes.shape({
    card_title: PropTypes.string,
    card_description_fbook: PropTypes.string,
    card_description_twitter: PropTypes.string,
    image: PropTypes.shape({
      url: PropTypes.string,
      type: PropTypes.string
    })
  }),
  publishPath: PropTypes.string,
  opinion: PropTypes.bool,
  customNodes: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.node, PropTypes.shape({
    slot: PropTypes.oneOf(['before', 'after-meta', 'after-social', 'after-compliance']).isRequired,
    node: PropTypes.node.isRequired
  })]))
};
export default Head;