<?php
/**
 * Order customizations.
 *
 * @package flo-checkout
 */

namespace Flo_Checkout;

use WP_Post;

/**
 * Order customizations.
 */
class Orders {
	/**
	 * Setup order customizations.
	 *
	 * @return void
	 */
	public static function setup(): void {
		add_action( 'add_meta_boxes', array( __CLASS__, 'register_order_debug_meta_box' ) );
	}

	/**
	 * Register order debug meta box.
	 */
	public static function register_order_debug_meta_box(): void {
		add_meta_box(
			'flo-debug-meta-box',
			'Flo Debug',
			array( __CLASS__, 'render_debug_meta_box' ),
			'shop_order',
			'normal',
			'low'
		);
	}

	/**
	 * Render order debug meta box.
	 *
	 * @param WP_Post $post Post object.
	 */
	public static function render_debug_meta_box( WP_Post $post ): void {
		$order_meta = get_post_meta( $post->ID );
		echo '<pre>';
		print_r( $order_meta );
		echo '</pre>';
	}
}
