/**
 * React hook that is used to mark the block wrapper element.
 * It provides all the necessary props like the class name.
 *
 * @see https://developer.wordpress.org/block-editor/reference-guides/packages/packages-block-editor/#useblockprops
 */
import { useBlockProps, useInnerBlocksProps } from "@wordpress/block-editor";

/**
 * The save function defines the way in which the different attributes should be
 * combined into the final markup, which is then serialized into post_content.
 *
 * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-edit-save/#save
 *
 * @return {WPElement} Element to render.
 */
export default function save ( props ) {

	// Standard editor block saving.
	// Note: 'variationsBlockId' is automatically added to blockprops.
	const blockProps = useBlockProps.save();
	// Note: Separating className at this point ensures it ends up not saved in the HTML :)
	const { className, ...innerBlocksProps } = useInnerBlocksProps.save( blockProps );

	return (
		<pwp-content-variations { ...innerBlocksProps } ></pwp-content-variations>
	);
}
