{
  "GS2TemplateFormatVersion": "2019-05-01",
  "Resources": {
    "ItemActionsNamespace": {
      "Type": "GS2::Exchange::Namespace",
      "Properties": {
        "Name": "adventure-item-actions",
        "TransactionSettingV2": {
          "DistributorNamespaceId": "grn:gs2:{region}:{ownerId}:distributor:default",
          "EnableParallelExecution": false
        }
      }
    },
    "ItemActionsMaster": {
      "Type": "GS2::Exchange::CurrentRateMaster",
      "Properties": {
        "NamespaceName": "adventure-item-actions",
        "Mode": "direct",
        "Settings": {
          "version": "2019-08-19",
          "rateModels": [
            {
              "name": "use_potion",
              "timingType": "immediate",
              "consumeActions": [
                {
                  "action": "Gs2Inventory:ConsumeSimpleItemsByUserId",
                  "request": "{\"userId\": \"#{userId}\", \"namespaceName\": \"adventure-inventory\", \"inventoryName\": \"Inventory\", \"consumeCounts\": [{\"itemName\": \"potion\", \"count\": 1}]}"
                }
              ],
              "acquireActions": [
                {
                  "action": "Gs2Stamina:RecoverStaminaByUserId",
                  "request": "{\"userId\": \"#{userId}\", \"namespaceName\": \"adventure-stamina\", \"staminaName\": \"stamina\", \"recoverValue\": 5}"
                }
              ]
            },
            {
              "name": "buy_potion",
              "timingType": "immediate",
              "consumeActions": [
                {
                  "action": "Gs2Money2:WithdrawByUserId",
                  "request": "{\"userId\": \"#{userId}\", \"namespaceName\": \"adventure-coin\", \"slot\": 0, \"withdrawCount\": 20, \"paidOnly\": false}"
                }
              ],
              "acquireActions": [
                {
                  "action": "Gs2Inventory:AcquireSimpleItemsByUserId",
                  "request": "{\"userId\": \"#{userId}\", \"namespaceName\": \"adventure-inventory\", \"inventoryName\": \"Inventory\", \"acquireCounts\": [{\"itemName\": \"potion\", \"count\": 1}]}"
                }
              ]
            }
          ]
        }
      },
      "DependsOn": [
        "ItemActionsNamespace",
        "InventoryMaster"
      ]
    },
    "InventoryNamespace": {
      "Type": "GS2::Inventory::Namespace",
      "Properties": {
        "Name": "adventure-inventory"
      }
    },
    "InventoryMaster": {
      "Type": "GS2::Inventory::CurrentItemModelMaster",
      "Properties": {
        "NamespaceName": "adventure-inventory",
        "Mode": "direct",
        "Settings": {
          "version": "2019-02-05",
          "simpleInventoryModels": [
            {
              "name": "Inventory",
              "simpleItemModels": [
                {
                  "name": "potion",
                  "metadata": "回復薬"
                }
              ]
            }
          ]
        }
      },
      "DependsOn": [
        "InventoryNamespace"
      ]
    }
  }
}
