// External Dependencies.
import React, { ReactElement } from 'react';

// Divi Dependencies.
import {
	ModuleContainer,
	ElementComponents,
} from '@divi/module';

// Local Dependencies.
import { RemoveFiltersEditProps } from './types';
import { ModuleStyles } from './styles';
import ServerSideRender from '../../server-side-render';
import { ModuleScriptData } from './module-script-data';
import { moduleClassnames } from './module-classnames';

/**
 * Static Module edit component of visual builder.
 *
 * @since ??
 *
 * @param {RemoveFiltersEditProps} props React component props.
 *
 * @returns {ReactElement}
 */
const RemoveFiltersEdit = (props: RemoveFiltersEditProps): ReactElement => {
	const {
		attrs,
		id,
		name,
		elements,
	} = props;

	return (
		<ModuleContainer
			attrs={attrs}
			elements={elements}
			id={id}
			name={name}
			stylesComponent={ModuleStyles}
			classnamesFunction={moduleClassnames}
			scriptDataComponent={ModuleScriptData}
		>
			{elements.styleComponents({
				attrName: 'module',
			})}
			<>
				<ElementComponents
					attrs={attrs?.module?.decoration ?? {}}
					id={id}
				/>
				<ServerSideRender
					block="jet-smart-filters-divi/remove-filters"
					attributes={attrs}
				/>
			</>
		</ModuleContainer>
	);
}

export {
	RemoveFiltersEdit,
};
