<?php

// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedNamespaceFound -- APD is the established namespace shared with the Pro add-on and retained for backward compatibility.
namespace APD\Api;

use APD\Api\Controllers\AssetController;
use APD\Api\Controllers\ConfigController;
use APD\Api\Controllers\DesignController;
use APD\Api\Controllers\PreviewController;
use APD\Api\Controllers\PricingController;
use APD\Api\Controllers\ProductBindingController;
use APD\Api\Controllers\UploadController;
use APD\Container;
use APD\Contracts\ServiceProviderInterface;

defined('ABSPATH') || exit;

class ApiServiceProvider implements ServiceProviderInterface
{
    public function __construct(protected Container $container)
    {
    }

    public function register() : void
    {
    }

    public function boot() : void
    {
        add_action('rest_api_init', function () : void {
            (new ConfigController())->registerRoutes();
            (new UploadController())->registerRoutes();
            (new DesignController())->registerRoutes();
            (new PricingController())->registerRoutes();
            (new PreviewController())->registerRoutes();
            (new AssetController())->registerRoutes();
            (new ProductBindingController())->registerRoutes();
        });
    }
}
