import {
	type Metadata,
	type ModuleLibrary,
} from '@divi/types';
import { generateModuleAttributes } from '../../utils';
import { RatingFilterEdit } from './edit';
import metadata from './module.json';
import { SettingsAdvanced } from './settings-advanced';
import { SettingsContent } from './settings-content';
import { SettingsDesign } from './settings-design';
import { RatingFilterAttrs } from './types';
import { placeholderContent } from './placeholder-content';

import './module.scss';

metadata.attributes = { ...metadata.attributes, ...generateModuleAttributes( 'rating' ) };

export const ratingFilter: ModuleLibrary.Module.RegisterDefinition<RatingFilterAttrs> = {
	// Imported json has no inferred type hence type-cast is necessary.
	metadata: metadata as Metadata.Values<RatingFilterAttrs>,
	placeholderContent,
	settings: {
		content:  SettingsContent,
		design:   SettingsDesign,
		advanced: SettingsAdvanced,
	},
	renderers: {
		edit: RatingFilterEdit,
	},
};
