import { useElementsStore } from '@pdfdraft/elements';
import { registerTemplate, setTemplateSectionLabel } from '@pdfdraft/core/template-registry';
import { __ } from '@wordpress/i18n';
import { woo } from './elements/data-field';
import { productTable } from './elements/product-table';
import { totalBlock } from './elements/order-totals';
import simpleInvoice from './templates/simple-invoice';
import invoiceTwo from './templates/invoice-two';
import invoiceThree from './templates/invoice-three';
import invoiceFour from './templates/invoice-four';
import wooCleanMinimalInvoice from './templates/woo-clean-minimal-invoice';
import storefrontWooInvoice from './templates/storefront-woo-invoice';


export function registerElements() {
	setTemplateSectionLabel( __( 'WooCommerce Templates', 'pdfdraft-pdf-invoices-for-woocommerce' ) );
	useElementsStore.getState().actions.registerCategory({
		namespace: 'woocommerce',
		label: __('WooCommerce Fields', 'pdfdraft-pdf-invoices-for-woocommerce'),
		order: 1,
	});
	useElementsStore.getState().actions.register(woo);
	useElementsStore.getState().actions.register(productTable);
	useElementsStore.getState().actions.register(totalBlock);

	registerTemplate(simpleInvoice);
	registerTemplate(invoiceTwo);
	registerTemplate(invoiceThree);
	registerTemplate(invoiceFour);
	registerTemplate(wooCleanMinimalInvoice);
	registerTemplate(storefrontWooInvoice);
}
