{
  "$schema": "https://playground.wordpress.net/blueprint-schema.json",
  "meta": {
    "title": "Page Marker demo",
    "description": "Sample Page with a few demo markers, an assignee and a reply.",
    "author": "rodionvynohradov",
    "categories": [
      "Collaboration"
    ]
  },
  "landingPage": "/sample-page/",
  "preferredVersions": {
    "php": "8.2",
    "wp": "latest"
  },
  "login": true,
  "steps": [
    {
      "step": "installPlugin",
      "pluginData": {
        "resource": "wordpress.org/plugins",
        "slug": "page-marker"
      },
      "options": {
        "activate": true
      }
    },
    {
      "step": "runPHP",
      "code": "<?php\nrequire_once '/wordpress/wp-load.php';\n\nuse Page_Marker\\Core\\Cache;\n\nglobal $wpdb;\n\n$now = current_time( 'mysql' );\n$page = get_page_by_path( 'sample-page' );\n$post_id = $page ? $page->ID : 2;\n\n$designer_id = username_exists( 'designer' ) ?: wp_insert_user( [\n    'user_login' => 'designer',\n    'user_pass' => wp_generate_password(),\n    'user_email' => 'designer@example.com',\n    'display_name' => 'Designer',\n    'role' => 'editor',\n] );\n\n$editor_content = function ( string $html ): string {\n    return wp_json_encode( [\n        'time' => time() * 1000,\n        'blocks' => [ [ 'id' => wp_generate_password( 10, false ), 'type' => 'paragraph', 'data' => [ 'text' => $html ] ] ],\n        'version' => '2.30.5',\n    ], JSON_UNESCAPED_SLASHES );\n};\n\n$markers = [\n    [\n        'title' => 'Make the page title bigger on mobile',\n        'description' => 'The title looks <b>too small</b> on phones. Let\\'s try 40px.',\n        'priority' => 'high',\n        'assignee' => $designer_id,\n        'coords' => [ 'x' => 260, 'y' => 230, 'screen_width' => 1280 ],\n        'reply' => 'Good catch! I\\'ll update the typography today.',\n        'reply_author' => $designer_id,\n    ],\n    [\n        'title' => 'Replace this text with a client testimonial',\n        'description' => 'We have a great quote from the <i>last project</i>, it fits here perfectly.',\n        'priority' => 'highest',\n        'assignee' => 1,\n        'coords' => [ 'x' => -220, 'y' => 420, 'screen_width' => 1280 ],\n    ],\n    [\n        'title' => 'Typo in this paragraph',\n        'description' => 'Small one, but let\\'s fix it before the launch.',\n        'priority' => 'low',\n        'assignee' => $designer_id,\n        'coords' => [ 'x' => 300, 'y' => 620, 'screen_width' => 1280 ],\n    ],\n];\n\nforeach ( $markers as $marker ) {\n    $wpdb->insert( Cache::db()->db_page_markers_table(), [\n        'post_id' => $post_id,\n        'title' => $marker['title'],\n        'description' => $editor_content( $marker['description'] ),\n        'status' => 'new',\n        'priority' => $marker['priority'],\n        'coords' => wp_json_encode( $marker['coords'] ),\n        'id_on_page' => 'page-marker-' . strtolower( wp_generate_password( 20, false ) ),\n        'assignee' => $marker['assignee'],\n        'viewed' => 0,\n        'author' => 1,\n        'created_at' => $now,\n        'updated_at' => $now,\n    ] );\n    if ( ! empty( $marker['reply'] ) ) {\n        $wpdb->insert( Cache::db()->db_replies_table(), [\n            'marker_id' => $wpdb->insert_id,\n            'content' => $editor_content( $marker['reply'] ),\n            'reaction' => -1,\n            'author' => $marker['reply_author'],\n            'created_at' => $now,\n            'updated_at' => $now,\n        ] );\n    }\n}\n"
    }
  ]
}