{
  "$schema": "https://playground.wordpress.net/blueprint-schema.json",
  "landingPage": "/wp-admin/admin.php?page=easycommerce-fakerpress",
  "preferredVersions": {
    "php": "8.3",
    "wp": "7.0"
  },
  "phpExtensionBundles": [
    "kitchen-sink"
  ],
  "features": {
    "networking": true
  },
  "steps": [
    {
      "step": "login",
      "username": "admin",
      "password": "password"
    },
    {
      "step": "installPlugin",
      "pluginZipFile": {
        "resource": "wordpress.org/plugins",
        "slug": "easycommerce"
      },
      "options": {
        "activate": true
      }
    },
    {
      "step": "installPlugin",
      "pluginZipFile": {
        "resource": "wordpress.org/plugins",
        "slug": "easycommerce-fakerpress"
      },
      "options": {
        "activate": true
      }
    },
    {
      "step": "setSiteOptions",
      "options": {
        "blogname": "EasyCommerce FakerPress Demo",
        "blogdescription": "Experience the power of realistic ecommerce data generation",
        "admin_email": "demo@example.com",
        "start_of_week": "1",
        "use_balanceTags": "0",
        "use_smilies": "1",
        "require_name_email": "1",
        "comments_notify": "1",
        "posts_per_rss": "10",
        "rss_use_excerpt": "0",
        "permalink_structure": "/%postname%/",
        "uploads_use_yearmonth_folders": "1",
        "show_avatars": "1",
        "avatar_default": "mystery",
        "avatar_rating": "G",
        "enable_app_passwords": "1",
        "WPLANG": ""
      }
    },
    {
      "step": "defineWpConfigConsts",
      "consts": {
        "WP_DEBUG": true,
        "WP_DEBUG_LOG": true,
        "WP_DEBUG_DISPLAY": false,
        "SCRIPT_DEBUG": true,
        "WP_MEMORY_LIMIT": "512M"
      }
    },
    {
      "step": "runPHP",
      "code": "<?php\n// Create demo user with appropriate capabilities\n$user_id = wp_create_user('demo', 'demo123', 'demo@example.com');\nif (!is_wp_error($user_id)) {\n    $user = new WP_User($user_id);\n    $user->set_role('administrator');\n    wp_update_user([\n        'ID' => $user_id,\n        'first_name' => 'Demo',\n        'last_name' => 'User',\n        'display_name' => 'Demo User',\n        'description' => 'Demo user for EasyCommerce FakerPress testing'\n    ]);\n}\n\n// Set up basic EasyCommerce configuration if available\nif (defined('EASYCOMMERCE_VERSION')) {\n    // Basic store settings\n    update_option('easycommerce_store_address', '123 Demo Street');\n    update_option('easycommerce_store_city', 'Demo City');\n    update_option('easycommerce_default_country', 'US:CA');\n    update_option('easycommerce_store_postcode', '90210');\n    update_option('easycommerce_currency', 'USD');\n    update_option('easycommerce_currency_pos', 'left');\n    update_option('easycommerce_price_decimal_sep', '.');\n    update_option('easycommerce_price_thousand_sep', ',');\n    update_option('easycommerce_price_num_decimals', '2');\n    \n    // Enable key features\n    update_option('easycommerce_manage_stock', 'yes');\n    update_option('easycommerce_enable_reviews', 'yes');\n    update_option('easycommerce_enable_coupons', 'yes');\n    \n    // Tax settings\n    update_option('easycommerce_calc_taxes', 'yes');\n    update_option('easycommerce_prices_include_tax', 'no');\n    update_option('easycommerce_tax_based_on', 'shipping');\n    \n    // Shipping settings\n    update_option('easycommerce_ship_to_countries', 'all');\n    update_option('easycommerce_enable_shipping_calc', 'yes');\n}\n\necho 'Demo environment configured successfully!';"
    },
    {
      "step": "installTheme",
      "themeZipFile": {
        "resource": "wordpress.org/themes",
        "slug": "storefront"
      },
      "options": {
        "activate": true
      }
    },
    {
      "step": "runPHP",
      "code": "<?php\n// Create sample pages for ecommerce\n$pages = [\n    'shop' => [\n        'title' => 'Shop',\n        'content' => '[easycommerce_products limit=\"12\" columns=\"3\"]',\n        'slug' => 'shop'\n    ],\n    'cart' => [\n        'title' => 'Cart',\n        'content' => '[easycommerce_cart]',\n        'slug' => 'cart'\n    ],\n    'checkout' => [\n        'title' => 'Checkout',\n        'content' => '[easycommerce_checkout]',\n        'slug' => 'checkout'\n    ],\n    'my-account' => [\n        'title' => 'My Account',\n        'content' => '[easycommerce_my_account]',\n        'slug' => 'my-account'\n    ]\n];\n\nforeach ($pages as $key => $page) {\n    $existing_page = get_page_by_path($page['slug']);\n    if (!$existing_page) {\n        $page_id = wp_insert_post([\n            'post_title' => $page['title'],\n            'post_content' => $page['content'],\n            'post_status' => 'publish',\n            'post_type' => 'page',\n            'post_name' => $page['slug']\n        ]);\n        \n        if ($page_id && !is_wp_error($page_id)) {\n            if ($key === 'shop') {\n                update_option('easycommerce_shop_page_id', $page_id);\n            } elseif ($key === 'cart') {\n                update_option('easycommerce_cart_page_id', $page_id);\n            } elseif ($key === 'checkout') {\n                update_option('easycommerce_checkout_page_id', $page_id);\n            } elseif ($key === 'my-account') {\n                update_option('easycommerce_myaccount_page_id', $page_id);\n            }\n        }\n    }\n}\n\necho 'EasyCommerce pages created successfully!';"
    },
    {
      "step": "runPHP",
      "code": "<?php\n// Create some basic product categories and attributes for demonstration\nif (function_exists('wp_insert_term') && taxonomy_exists('product_cat')) {\n    // Product categories\n    $categories = [\n        'Electronics' => 'High-tech gadgets and devices',\n        'Clothing' => 'Fashion and apparel for all occasions',\n        'Home & Garden' => 'Everything for your home and outdoor spaces',\n        'Sports & Fitness' => 'Gear for active lifestyles',\n        'Books & Media' => 'Literature, movies, and digital content'\n    ];\n    \n    foreach ($categories as $name => $description) {\n        $existing = term_exists($name, 'product_cat');\n        if (!$existing) {\n            $term = wp_insert_term($name, 'product_cat', [\n                'description' => $description,\n                'slug' => sanitize_title($name)\n            ]);\n        }\n    }\n    \n    // Product tags\n    $tags = ['Popular', 'New Arrival', 'Best Seller', 'On Sale', 'Featured'];\n    foreach ($tags as $tag) {\n        $existing = term_exists($tag, 'product_tag');\n        if (!$existing) {\n            wp_insert_term($tag, 'product_tag', [\n                'slug' => sanitize_title($tag)\n            ]);\n        }\n    }\n}\n\necho 'Basic product taxonomies created!';"
    },
    {
      "step": "runPHP",
      "code": "<?php\n// Add welcome notice and helpful tips\nupdate_option('easycommerce_fakerpress_demo_notice', [\n    'type' => 'info',\n    'message' => 'Welcome to EasyCommerce FakerPress Demo! This environment is pre-configured with EasyCommerce plugin and sample data structures. Visit the FakerPress admin page to start generating realistic ecommerce data, including enhanced shipping plans with quantity-based calculations and improved regional coverage.',\n    'dismissible' => true\n]);\n\n// Set up demo-friendly admin settings\nupdate_option('show_on_front', 'posts');\nupdate_option('posts_per_page', 10);\nupdate_option('default_comment_status', 'open');\nupdate_option('default_ping_status', 'open');\n\n// Create a sample menu\n$menu_id = wp_create_nav_menu('Main Menu');\nif (!is_wp_error($menu_id) && $menu_id) {\n    // Add pages to menu\n    $pages = ['shop', 'cart', 'checkout', 'my-account'];\n    $menu_order = 1;\n    \n    foreach ($pages as $page_slug) {\n        $page = get_page_by_path($page_slug);\n        if ($page) {\n            wp_update_nav_menu_item($menu_id, 0, [\n                'menu-item-title' => $page->post_title,\n                'menu-item-object' => 'page',\n                'menu-item-object-id' => $page->ID,\n                'menu-item-type' => 'post_type',\n                'menu-item-status' => 'publish',\n                'menu-item-position' => $menu_order++\n            ]);\n        }\n    }\n    \n    // Assign menu to primary location\n    $locations = get_theme_mod('nav_menu_locations', []);\n    $locations['primary'] = $menu_id;\n    set_theme_mod('nav_menu_locations', $locations);\n}\n\n// Generate sample shipping plans using FakerPress if available\nif (class_exists('EasyCommerceFakerPress\\Generators\\Shipping_Plan')) {\n    $generator = new EasyCommerceFakerPress\\Generators\\Shipping_Plan();\n    $results = $generator->generate_multiple(3, []);\n    if (!empty($results)) {\n        update_option('easycommerce_fakerpress_sample_shipping_plans', $results);\n        echo 'Sample shipping plans generated! ';\n    }\n}\n\necho 'Demo environment fully configured! Ready for EasyCommerce FakerPress testing.';"
    }
  ],
  "meta": {
    "title": "EasyCommerce FakerPress Demo",
    "description": "Experience the comprehensive EasyCommerce FakerPress plugin with 14 specialized data generators, modern React interface, and realistic ecommerce data generation, featuring enhanced shipping plan capabilities.",
    "author": "Al Amin Ahamed",
    "categories": [
      "ecommerce",
      "data-generation",
      "testing",
      "development",
      "wordpress-playground"
    ],
    "difficulty": "beginner"
  }
}
