( function( wp ) {
	const { __ } = wp.i18n;
	const { registerBlockType, getBlockType } = wp.blocks;
	const { createElement: el } = wp.element;

	if ( getBlockType && getBlockType( 'foodord/reservations' ) ) {
		return;
	}

	registerBlockType( 'foodord/reservations', {
		title: __( 'FoodOrd Reservations', 'foodord' ),
		description: __( 'Display the table reservation form.', 'foodord' ),
		icon: 'calendar-alt',
		category: 'widgets',
		keywords: [
			__( 'reservations', 'foodord' ),
			__( 'tables', 'foodord' ),
			__( 'foodord', 'foodord' ),
		],
		edit: function Edit() {
			return el(
				'div',
				{ className: 'foodord-products-block-preview' },
				el(
					'div',
					{ className: 'foodord-block-placeholder' },
					el( 'h3', null, __( 'FoodOrd Reservations', 'foodord' ) ),
					el( 'p', null, __( 'Displays the table reservation form with available dates, times, and customer details.', 'foodord' ) )
				)
			);
		},
		save: function Save() {
			return null;
		},
	} );
}( window.wp ) );
