// External dependencies.
import {
	type Metadata,
	type ModuleLibrary,
} from '@divi/types';
import { generateModuleAttributes } from '../../utils';

// Local dependencies.
import { ColorImageEdit } from './edit';
import metadata from './module.json';
import { SettingsAdvanced } from './settings-advanced';
import { SettingsContent } from './settings-content';
import { SettingsDesign } from './settings-design';
import { placeholderContent } from './placeholder-content';
import { ColorImageAttrs } from './types';
import './module.scss';

metadata.attributes = { ...metadata.attributes, ...generateModuleAttributes( 'color-image' ) };

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