<?php
namespace FuseCommerce\Hooks;

if ( ! defined( 'ABSPATH' ) ) exit;

use FuseCommerce\Controllers\IndexCtrl;

class ActionRestApi implements IHook {

    static function register() {
        add_action('rest_api_init', [self::class, 'registerRoutes']);
    }

    static function registerRoutes(): void {
        register_rest_route('fuse-commerce/v1', '/index', [
            [
                'methods'             => \WP_REST_Server::READABLE,
                'callback'            => [IndexCtrl::class, 'index'],
                'args'                => [],
                'permission_callback' => '__return_true',
            ],
        ]);
    }
}