/**
 * External dependencies.
 */
import { ToggleControl } from '@wordpress/components';
import { __ } from '@wordpress/i18n';

/**
 * Renders a toggle control for enabling/disabling full content replacement.
 *
 * Allows users to specify whether dynamic content should replace the entire content
 * of a block. Updates the dynamic content settings with the selected value.
 *
 * @since x.x.x
 *
 * @param {Object}   props               - The component props.
 * @param {Object}   props.settings      - The dynamic content settings from the context.
 * @param {Function} props.updateSetting - Function to update settings in the context.
 * @return {Element} The toggle control for replacing full content.
 */
const ReplaceFullContentControl = ( { settings, updateSetting } ) => (
	<ToggleControl
		__nextHasNoMarginBottom
		__next40pxDefaultSize
		label={ __( 'Replace Full Content', 'spectra-pro' ) }
		checked={ settings.replaceFullContent }
		onChange={ ( newValue ) => updateSetting( 'replaceFullContent', newValue ) }
	/>
);

export default ReplaceFullContentControl;
