/**
 * Team Group — editor component.
 *
 * A plain InnerBlocks shell (twin of testimonial-pro's TestimonialGroupEdit):
 * only the addon blocks are insertable and the appender is hidden —
 * children are managed by the grid's Display Settings toggles via
 * useTeamChildBlocks, not by hand.
 */

import { useBlockProps, InnerBlocks } from '@wordpress/block-editor';
import useUniqueId from '../../hooks/useUniqueId';

// Layouts are left out so the inserter routes new blocks after the group
// instead of into it — a second layout here would share the group's query state.
const ALLOWED_BLOCKS = ['sptp/ajax-pagination', 'sptp/ajax-member-search'];

export default function Edit({ clientId, attributes, setAttributes }) {
	const { uniqueId } = attributes;

	useUniqueId(clientId, uniqueId, setAttributes, 'sp-smart-team-group-', 'sptp/');

	const blockProps = useBlockProps({ className: 'sp-smart-team-wrapper' });

	return (
		<div {...blockProps}>
			<div id={uniqueId} className="sp-smart-team-group">
				<InnerBlocks
					allowedBlocks={ALLOWED_BLOCKS}
					orientation="vertical"
					renderAppender={false}
				/>
			</div>
		</div>
	);
}
