<?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\Front;

use APD\Admin\AdminSettings;

defined('ABSPATH') || exit;

class ShortcodeController
{
    public function __construct(
        protected Renderer $renderer,
        protected AdminSettings $settings
    )
    {
    }

    public function render(array $atts = []) : string
    {
        $settings = $this->settings->all();
        $atts = shortcode_atts([
            'id' => 0,
            'product_id' => 0,
            'variation_id' => 0,
            'config' => '',
            'mode' => (string) ($settings['default_mode'] ?? 'standalone'),
            'height' => (string) ($settings['default_height'] ?? '720px'),
            'class' => '',
            'resume_design_id' => 0,
            'resume_token' => '',
        ], $atts, 'asuka_designer');

        return $this->renderer->render($atts);
    }
}
