{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "barView": {
      "properties": {
        "days": {
          "description": "For how many days.",
          "minimum": 0,
          "type": "integer"
        },
        "groups": {
          "description": "How many groups keep it.",
          "minimum": 1,
          "type": "integer"
        }
      },
      "required": [
        "groups",
        "days"
      ],
      "type": "object"
    },
    "main": {
      "description": "How groups on this host use a template shared with everyone, for whoever made it: counts, never which groups, and never what anyone wrote in a tab of it, which stays in each group. Groups on other hosts can't be seen. For a person's template, them; for a group's, whoever may publish for it.",
      "errors": [
        {
          "name": "NotFound"
        },
        {
          "name": "Forbidden"
        }
      ],
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "bar": {
              "description": "What it takes to be listed here.",
              "ref": "#barView",
              "type": "ref"
            },
            "keptAWhile": {
              "description": "Of those, the groups that have had it for as long as the bar asks.",
              "minimum": 0,
              "type": "integer"
            },
            "keptBy": {
              "description": "Groups with a tab of it now, of any version.",
              "minimum": 0,
              "type": "integer"
            },
            "notNow": {
              "description": "Versions groups undid, and how many groups for each.",
              "items": {
                "ref": "#notNowView",
                "type": "ref"
              },
              "type": "array"
            },
            "tookOff": {
              "description": "Groups that removed a tab of it in the last 30 days and have none now.",
              "minimum": 0,
              "type": "integer"
            }
          },
          "required": [
            "keptBy",
            "keptAWhile",
            "tookOff",
            "notNow",
            "bar"
          ],
          "type": "object"
        }
      },
      "parameters": {
        "properties": {
          "uri": {
            "description": "The template, its fyi.opensocial.template.",
            "format": "at-uri",
            "type": "string"
          }
        },
        "required": [
          "uri"
        ],
        "type": "params"
      },
      "type": "query"
    },
    "notNowView": {
      "properties": {
        "groups": {
          "minimum": 1,
          "type": "integer"
        },
        "number": {
          "minimum": 1,
          "type": "integer"
        },
        "version": {
          "format": "cid",
          "type": "string"
        }
      },
      "required": [
        "version",
        "groups"
      ],
      "type": "object"
    }
  },
  "id": "fyi.opensocial.getTemplateUse",
  "lexicon": 1
}
