<?php
/**
 * Block styles.
 *
 * @package car-dealership-carkit
 * @since 1.0.0
 */

function car_dealership_carkit_block_woo_register_block_styles() {

	register_block_style( // phpcs:ignore WPThemeReview.PluginTerritory.ForbiddenFunctions.editor_blocks_register_block_style
		'core/button',
		array(
			'name'  => 'car-dealership-carkit-flat-button',
			'label' => esc_html__( 'Flat button', 'car-dealership-carkit' ),
		)
	);

	register_block_style( // phpcs:ignore WPThemeReview.PluginTerritory.ForbiddenFunctions.editor_blocks_register_block_style
		'core/list',
		array(
			'name'  => 'car-dealership-carkit-list-underline',
			'label' => esc_html__( 'Underlined list items', 'car-dealership-carkit' ),
		)
	);

	register_block_style( // phpcs:ignore WPThemeReview.PluginTerritory.ForbiddenFunctions.editor_blocks_register_block_style
		'core/group',
		array(
			'name'  => 'car-dealership-carkit-box-shadow',
			'label' => esc_html__( 'Box shadow', 'car-dealership-carkit' ),
		)
	);

	register_block_style( // phpcs:ignore WPThemeReview.PluginTerritory.ForbiddenFunctions.editor_blocks_register_block_style
		'core/column',
		array(
			'name'  => 'car-dealership-carkit-box-shadow',
			'label' => esc_html__( 'Box shadow', 'car-dealership-carkit' ),
		)
	);

	register_block_style( // phpcs:ignore WPThemeReview.PluginTerritory.ForbiddenFunctions.editor_blocks_register_block_style
		'core/columns',
		array(
			'name'  => 'car-dealership-carkit-box-shadow',
			'label' => esc_html__( 'Box shadow', 'car-dealership-carkit' ),
		)
	);

	register_block_style( // phpcs:ignore WPThemeReview.PluginTerritory.ForbiddenFunctions.editor_blocks_register_block_style
		'core/details',
		array(
			'name'  => 'car-dealership-carkit-plus',
			'label' => esc_html__( 'Plus & minus', 'car-dealership-carkit' ),
		)
	);
}
add_action( 'init', 'car_dealership_carkit_block_woo_register_block_styles' );

/**
 * This is an example of how to unregister a core block style.
 *
 * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-styles/
 * @see https://github.com/WordPress/gutenberg/pull/37580
 *
 * @since 1.0.0
 *
 * @return void
 */
function car_dealership_carkit_block_woo_unregister_block_style() {
	wp_enqueue_script(
		'car-dealership-carkit-unregister',
		get_stylesheet_directory_uri() . '/assets/js/unregister.js',
		array( 'wp-blocks', 'wp-dom-ready', 'wp-edit-post' ),
		CAR_DEALERSHIP_CARKIT,
		true
	);
}
add_action( 'enqueue_block_editor_assets', 'car_dealership_carkit_block_woo_unregister_block_style' );
