{
    "$schema": "https://playground.wordpress.net/blueprint-schema.json",
    "landingPage": "/",
    "preferredVersions": {
        "php": "8.1",
        "wp": "latest"
    },
    "features": {
        "networking": true
    },
    "steps": [
        {
            "step": "writeFile",
            "path": "/wordpress/wp-content/mu-plugins/redirect-to-product.php",
            "data": "<?php add_action('template_redirect', function() { if (get_transient('playground_redirected')) return; $products = get_posts(['post_type' => 'product', 'posts_per_page' => 1]); if ($products) { set_transient('playground_redirected', 1); wp_redirect(get_permalink($products[0]->ID)); exit; } });"
        },
        {
            "step": "login",
            "username": "admin"
        },
        {
            "step": "installPlugin",
            "pluginData": {
                "resource": "wordpress.org/plugins",
                "slug": "woocommerce"
            },
            "options": {
                "activate": true
            }
        },
        {
            "step": "runPHP",
            "code": "<?php require_once 'wordpress/wp-load.php'; update_option('woocommerce_onboarding_profile', ['skipped' => true]); update_option('wc_onboarding_opt_in', 'no'); delete_option('woocommerce_show_marketplace_suggestions'); update_option('woocommerce_admin_install_timestamp', 1); ?>"
        },
        {
            "step": "installPlugin",
            "pluginData": {
                "resource": "wordpress.org/plugins",
                "slug": "3d-product-customizer"
            },
            "options": {
                "activate": true
            }
        },
        {
            "step": "runPHP",
            "code": "<?php require_once 'wordpress/wp-load.php'; $posts = [['Red', '#FF0000'], ['White', '#FFFFFF'], ['Blue', '#0000FF']]; foreach ($posts as [$title, $color]) { $id = wp_insert_post(['post_title' => $title, 'post_type' => 'dprcu_model_texture', 'post_status' => 'publish']); update_post_meta($id, '_dprcu_texture_color', $color); } ?>"
        },
        {
            "step": "runPHP",
            "code": "<?php require_once 'wordpress/wp-load.php'; require_once ABSPATH . 'wp-admin/includes/media.php'; require_once ABSPATH . 'wp-admin/includes/file.php'; require_once ABSPATH . 'wp-admin/includes/image.php'; $url = 'https://web-support.eu/wp-content/uploads/2025/11/chair.glb'; $tmp = download_url($url); $file = array('name' => 'chair.glb', 'tmp_name' => $tmp); $id = media_handle_sideload($file, 0); update_option('_playground_model_id', $id); ?>"
        },
        {
            "step": "runPHP",
            "code": "<?php require_once 'wordpress/wp-load.php'; $model_id = get_option('_playground_model_id'); $model_url = wp_get_attachment_url($model_id); $id = wp_insert_post(['post_title' => 'Edit me!', 'post_type' => 'product', 'post_status' => 'publish', 'post_content' => 'Edit this product in the admin panel to add more steps, materials.']); wp_set_object_terms($id, 'simple', 'product_type'); update_post_meta($id, '_dprcu_3d_model_url', $model_url); update_option('_playground_product_id', $id); ?>"
        },
        {
            "step": "runPHP",
            "code": "<?php require_once 'wordpress/wp-load.php'; $product_id = get_option('_playground_product_id'); $red = get_page_by_title('Red', OBJECT, 'dprcu_model_texture')->ID; $white = get_page_by_title('White', OBJECT, 'dprcu_model_texture')->ID; $blue = get_page_by_title('Blue', OBJECT, 'dprcu_model_texture')->ID; $all = implode(',', [$red, $white, $blue]); $config = ['step1' => ['name' => 'Base', 'description' => '', 'targets' => ['base'], 'options' => ['opt1' => ['name' => 'Materials', 'texture_ids' => $all, 'show' => [], 'hide' => []]]], 'step2' => ['name' => 'Maner', 'description' => '', 'targets' => ['maner'], 'options' => ['opt1' => ['name' => 'Materials', 'texture_ids' => $all, 'show' => [], 'hide' => []]]], 'step3' => ['name' => 'Sezut', 'description' => '', 'targets' => ['sezut'], 'options' => ['opt1' => ['name' => 'Materials', 'texture_ids' => $all, 'show' => [], 'hide' => []]]], 'step4' => ['name' => 'Spate', 'description' => '', 'targets' => ['spate'], 'options' => ['opt1' => ['name' => 'Materials', 'texture_ids' => $all, 'show' => [], 'hide' => []]]]]; update_post_meta($product_id, '_dprcu_customizer_config', wp_json_encode($config)); ?>"
        }
    ]
}