{
  "templateMeta": {
    "name": "view-permissions",
    "title": "View Permissions",
    "category": "system"
  },
  "type": "AdaptiveCard",
  "body": [
    {
      "type": "Jumbotron",
      "title": "View Permissions"
    },
    {
      "type": "Container",
      "spacing": "none",
      "items": [
        {
          "id": "stateMachine",
          "type": "Input.Text",
          "title": "State Machine Name"
        },
        {
          "id": "roleId",
          "type": "Input.Text",
          "title": "Role ID"
        },
        {
          "type": "Container",
          "spacing": "none",
          "justifyContent": true,
          "items": [
            {
              "type": "TextBlock",
              "text": "{{ data.totalHits || 0 }} result{{ data.totalHits === 1 ? '' : 's' }}"
            },
            {
              "type": "Action.ApiLookup",
              "title": "Search",
              "stateMachineName": "tymly_searchPermissions_1_0",
              "input": {
                "page": "$.page",
                "stateMachine": "$.stateMachine",
                "roleId": "$.roleId"
              }
            }
          ]
        }
      ]
    },
    {
      "type": "Container",
      "spacing": "none",
      "showWhen": "data.results && data.results.length",
      "items": [
        {
          "id": "resultsTable",
          "type": "MarkupTable",
          "arrayPath": "data.results",
          "columns": [
            {
              "title": "State Machine Name",
              "value": "{{ item.stateMachineName }}"
            },
            {
              "title": "Role ID",
              "value": "{{ item.roleId }}"
            },
            {
              "title": "Allows",
              "value": "{{ item.allows.join(', ') }}"
            },
            {
              "title": "Created",
              "value": "{{ formatDate(item.created, 'Do MMM YYYY HH:mm') }}"
            },
            {
              "title": "Modified",
              "value": "{{ formatDate(item.modified, 'Do MMM YYYY HH:mm') }}"
            }
          ]
        },
        {
          "type": "Pagination",
          "page": "data.page",
          "totalPages": "data.totalPages",
          "endpoint": {
            "stateMachineName": "tymly_searchPermissions_1_0",
            "input": {
              "page": "$.page",
              "stateMachine": "$.stateMachine",
              "roleId": "$.roleId"
            }
          }
        }
      ]
    }
  ],
  "actions": [
    {
      "type": "Action.Cancel",
      "title": "Cancel"
    }
  ],
  "$schema": "https://raw.githubusercontent.com/wmfs/cardscript-schema/master/lib/schema.json",
  "version": "1.0"
}
