{
  "lexicon": 1,
  "id": "tools.ozone.report.queryReports",
  "defs": {
    "main": {
      "type": "query",
      "description": "View moderation reports. Reports are individual instances of content being reported, as opposed to subject statuses which aggregate reports at the subject level.",
      "parameters": {
        "type": "params",
        "required": ["status"],
        "properties": {
          "queueId": {
            "type": "integer",
            "description": "Filter by queue ID. Use -1 for unassigned reports."
          },
          "reportTypes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Filter by report types (fully qualified string in the format of com.atproto.moderation.defs#reason<name>)."
          },
          "status": {
            "type": "string",
            "knownValues": [
              "open",
              "closed",
              "escalated",
              "queued",
              "assigned"
            ],
            "description": "Filter by report status."
          },
          "subject": {
            "type": "string",
            "format": "uri",
            "description": "Filter by subject DID or AT-URI."
          },
          "did": {
            "type": "string",
            "format": "did",
            "description": "Filter to reports where the subject is this DID or any record owned by this DID. Unlike `subject` (which scopes to a specific account or record), this returns all reports tied to the DID across both account-level and record-level subjects."
          },
          "subjectType": {
            "type": "string",
            "description": "If specified, reports of the given type (account or record) will be returned.",
            "knownValues": ["account", "record"]
          },
          "collections": {
            "type": "array",
            "maxLength": 20,
            "description": "If specified, reports where the subject belongs to the given collections will be returned. When subjectType is set to 'account', this will be ignored.",
            "items": {
              "type": "string",
              "format": "nsid"
            }
          },
          "reportedAfter": {
            "type": "string",
            "format": "datetime",
            "description": "Retrieve reports created after a given timestamp"
          },
          "reportedBefore": {
            "type": "string",
            "format": "datetime",
            "description": "Retrieve reports created before a given timestamp"
          },
          "isMuted": {
            "type": "boolean",
            "default": false,
            "description": "Filter by muted status. true returns only muted reports, false returns only unmuted reports. Defaults to false."
          },
          "assignedTo": {
            "type": "string",
            "format": "did",
            "description": "Filter by the DID of the moderator permanently assigned to the report."
          },
          "sortField": {
            "type": "string",
            "default": "createdAt",
            "enum": ["createdAt", "updatedAt"]
          },
          "sortDirection": {
            "type": "string",
            "default": "desc",
            "enum": ["asc", "desc"]
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "default": 50
          },
          "cursor": {
            "type": "string"
          }
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "type": "object",
          "required": ["reports"],
          "properties": {
            "cursor": {
              "type": "string"
            },
            "reports": {
              "type": "array",
              "items": {
                "type": "ref",
                "ref": "tools.ozone.report.defs#reportView"
              }
            }
          }
        }
      }
    }
  }
}
