{
  "api": "darkwind-extension.1",
  "id": "garden.team-lantern",
  "revision": "1",
  "profile": "object-response.1",
  "capabilities": [
    "state",
    "material",
    "unlock"
  ],
  "state": {
    "type": "object",
    "fields": {
      "previous": {
        "type": "string",
        "maxLength": 36
      },
      "turns": {
        "type": "number",
        "min": 0,
        "max": 8,
        "integer": true
      }
    }
  },
  "defaults": {
    "previous": "",
    "turns": 0
  },
  "configuration": {
    "type": "object",
    "fields": {
      "turns": {
        "type": "number",
        "min": 2,
        "max": 8,
        "integer": true
      }
    }
  },
  "source": {
    "format": 1,
    "hooks": {
      "onInteract": [
        {
          "let": "turns",
          "value": {
            "get": [
              "state",
              "turns"
            ]
          }
        },
        {
          "if": {
            "op": "ne",
            "args": [
              {
                "get": [
                  "event",
                  "actor"
                ]
              },
              {
                "get": [
                  "state",
                  "previous"
                ]
              }
            ]
          },
          "then": [
            {
              "let": "turns",
              "value": {
                "op": "min",
                "args": [
                  {
                    "get": [
                      "configuration",
                      "turns"
                    ]
                  },
                  {
                    "op": "add",
                    "args": [
                      {
                        "var": "turns"
                      },
                      1
                    ]
                  }
                ]
              }
            }
          ]
        },
        {
          "setState": {
            "object": {
              "previous": {
                "get": [
                  "event",
                  "actor"
                ]
              },
              "turns": {
                "var": "turns"
              }
            }
          }
        },
        {
          "if": {
            "op": "ge",
            "args": [
              {
                "var": "turns"
              },
              {
                "get": [
                  "configuration",
                  "turns"
                ]
              }
            ]
          },
          "then": [
            {
              "write": "MaterialSelection",
              "value": {
                "object": {
                  "variant": "active"
                }
              }
            }
          ]
        }
      ]
    }
  }
}
