import { __ } from '@wordpress/i18n';
import type { Option } from '@/admin/api/activities';
import { createOptionsField } from './options-field';

declare module '@tiptap/core' {
	interface Commands<ReturnType> {
		checkbox: {
			insertCheckbox: (attrs?: {
				label?: string;
				required?: boolean;
				options?: Option[];
			}) => ReturnType;
		};
	}
}

export const Checkbox = createOptionsField({
	name: 'checkbox',
	dataType: 'checkbox',
	typeLabel: __('Checkboxes', 'allcoach'),
	commandName: 'insertCheckbox',
	isCheckbox: true,
});
