<?php
/**
 * Class DhlPolskaMenu
 *
 * @package DhlPolska\Admin
 */

namespace DhlPolska\Admin;

use DhlPolska\Admin\Menu\ShipmentsSubmenu;
use DhlPolskaVendor\WPDesk\PluginBuilder\Plugin\Hookable;

/**
 * Register DHL Polska admin menu.
 */
class DhlPolskaMenu implements Hookable {
	public const MENU_SLUG = 'dhl-polska';

	private ShipmentsSubmenu $shipments_submenu;

	public function __construct( ShipmentsSubmenu $shipments_submenu ) {
		$this->shipments_submenu = $shipments_submenu;
	}

	/**
	 * Hooks.
	 */
	public function hooks() {
		add_action( 'admin_menu', [ $this, 'register_menu' ] );
	}

	/**
	 * @return void
	 */
	public function register_menu() {
		add_menu_page(
			__( 'DHL Polska', 'dhl-polska' ),
			__( 'DHL Polska', 'dhl-polska' ),
			'manage_woocommerce',
			self::MENU_SLUG,
			[ $this->shipments_submenu, 'render_page' ],
			'dashicons-location',
			56
		);
	}
}
