{
  "lexicon": 1,
  "id": "tools.ozone.inbox.defs",
  "defs": {
    "subjectView": {
      "type": "object",
      "description": "A subject belonging to the viewer that has moderation actions against it.",
      "required": [
        "src",
        "subject",
        "enforcement",
        "isRead",
        "createdAt",
        "updatedAt"
      ],
      "properties": {
        "src": {
          "type": "string",
          "format": "did",
          "description": "DID of the moderation service that took the actions."
        },
        "subject": {
          "type": "union",
          "refs": [
            "com.atproto.admin.defs#repoRef",
            "com.atproto.repo.strongRef"
          ]
        },
        "enforcement": {
          "type": "ref",
          "ref": "#enforcementView"
        },
        "appeal": {
          "type": "ref",
          "ref": "#appealView"
        },
        "availableActions": {
          "type": "array",
          "items": {
            "type": "string",
            "knownValues": ["appeal"]
          }
        },
        "latestAction": {
          "type": "ref",
          "ref": "#actionView"
        },
        "actionCount": {
          "type": "integer"
        },
        "createdAt": {
          "type": "string",
          "format": "datetime"
        },
        "updatedAt": {
          "type": "string",
          "format": "datetime"
        },
        "isRead": {
          "type": "boolean"
        }
      }
    },
    "enforcementView": {
      "type": "object",
      "description": "The current enforcement state of a subject.",
      "required": ["state"],
      "properties": {
        "state": {
          "type": "string",
          "knownValues": [
            "none",
            "labeled",
            "removed",
            "suspended",
            "takendown"
          ]
        },
        "scope": {
          "type": "string",
          "knownValues": ["network", "app", "labelOnly"]
        },
        "expiresAt": {
          "type": "string",
          "format": "datetime"
        },
        "labels": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Active label values on the subject, excluding negated and expired labels."
        }
      }
    },
    "appealView": {
      "type": "object",
      "description": "The state of the viewer's appeal against the actions on a subject.",
      "required": ["state"],
      "properties": {
        "state": {
          "type": "string",
          "knownValues": [
            "none",
            "pending",
            "resolved",
            "superseded",
            "expired"
          ]
        },
        "appealedAt": {
          "type": "string",
          "format": "datetime"
        },
        "resolvedAt": {
          "type": "string",
          "format": "datetime",
          "description": "When the appeal's report was closed."
        },
        "appealableUntil": {
          "type": "string",
          "format": "datetime"
        }
      }
    },
    "actionView": {
      "type": "object",
      "description": "A single moderation action taken against a subject.",
      "required": ["id", "type", "createdAt"],
      "properties": {
        "id": {
          "type": "integer",
          "description": "Action ID (moderation event ID)."
        },
        "type": {
          "type": "string",
          "description": "Public action type."
        },
        "scope": {
          "type": "string",
          "knownValues": ["network", "app", "labelOnly"]
        },
        "createdAt": {
          "type": "string",
          "format": "datetime"
        },
        "reversedAt": {
          "type": "string",
          "format": "datetime"
        },
        "expiresAt": {
          "type": "string",
          "format": "datetime"
        },
        "labels": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Label values, for labelApplied/labelRemoved."
        },
        "policies": {
          "type": "array",
          "items": {
            "type": "ref",
            "ref": "#policyView"
          },
          "description": "Policies applied by a takedown action."
        }
      }
    },
    "policyView": {
      "type": "object",
      "required": ["key", "displayName", "link"],
      "properties": {
        "key": { "type": "string" },
        "displayName": { "type": "string" },
        "link": { "type": "string", "format": "uri" }
      }
    },
    "subjectViewDetail": {
      "type": "object",
      "description": "A subject with a page of its action history and an aggregate report summary. Follow cursor to retrieve older actions; enforcement and appeal describe the current subject state on every page.",
      "required": [
        "src",
        "subject",
        "enforcement",
        "isRead",
        "actions",
        "createdAt",
        "updatedAt"
      ],
      "properties": {
        "src": {
          "type": "string",
          "format": "did"
        },
        "isRead": {
          "type": "boolean"
        },
        "subject": {
          "type": "union",
          "refs": [
            "com.atproto.admin.defs#repoRef",
            "com.atproto.repo.strongRef"
          ]
        },
        "record": {
          "type": "unknown",
          "description": "Raw record JSON for the subject, when the subject is a record and the record is available."
        },
        "enforcement": {
          "type": "ref",
          "ref": "#enforcementView"
        },
        "appeal": {
          "type": "ref",
          "ref": "#appealView"
        },
        "availableActions": {
          "type": "array",
          "items": {
            "type": "string",
            "knownValues": ["appeal"]
          }
        },
        "actions": {
          "type": "array",
          "description": "A page of action history, most recent first. Reversal timestamps include changes outside this page.",
          "maxLength": 100,
          "items": {
            "type": "ref",
            "ref": "#actionView"
          }
        },
        "cursor": {
          "type": "string",
          "description": "Cursor for the next page of action history. Omitted when no older actions remain."
        },
        "reports": {
          "type": "ref",
          "ref": "#reportsSummary",
          "description": "Omitted when the subject has never been reported, e.g. proactive enforcement."
        },
        "createdAt": {
          "type": "string",
          "format": "datetime"
        },
        "updatedAt": {
          "type": "string",
          "format": "datetime"
        }
      }
    },
    "reportsSummary": {
      "type": "object",
      "description": "Aggregate view of reports filed against this subject. Deliberately carries no report IDs, no count, and no reporter identities.",
      "required": ["reasonTypes", "firstReportedOn", "lastReportedOn"],
      "properties": {
        "reasonTypes": {
          "type": "array",
          "description": "Distinct reason types reported, deduplicated and unordered. Excludes reasonAppeal.",
          "items": {
            "type": "string"
          }
        },
        "firstReportedOn": {
          "type": "string",
          "format": "datetime",
          "description": "Day of the earliest report, truncated to midnight UTC. Render as a date; the time component is not meaningful."
        },
        "lastReportedOn": {
          "type": "string",
          "format": "datetime",
          "description": "Day of the most recent report, truncated to midnight UTC. Render as a date; the time component is not meaningful."
        }
      }
    },
    "notification": {
      "type": "object",
      "required": ["id", "reason", "target", "isRead", "createdAt"],
      "properties": {
        "id": {
          "type": "integer"
        },
        "reason": {
          "type": "string",
          "knownValues": [
            "reportResolved",
            "reportReopened",
            "actionTaken",
            "actionReversed",
            "appealResolved",
            "standingChanged"
          ]
        },
        "target": {
          "type": "union",
          "refs": ["#reportRef", "#subjectRef", "#standingRef"]
        },
        "isRead": {
          "type": "boolean"
        },
        "createdAt": {
          "type": "string",
          "format": "datetime"
        }
      }
    },
    "notificationPreferences": {
      "type": "object",
      "required": ["push"],
      "properties": {
        "push": {
          "type": "boolean"
        }
      }
    },
    "reportRef": {
      "type": "object",
      "description": "Reference to a report by its report table ID, as used by getReport and Ozone's report detail page.",
      "required": ["reportId"],
      "properties": {
        "reportId": {
          "type": "integer"
        },
        "subject": {
          "type": "union",
          "refs": [
            "com.atproto.admin.defs#repoRef",
            "com.atproto.repo.strongRef"
          ]
        },
        "status": {
          "type": "string",
          "knownValues": ["pending", "resolved"]
        }
      }
    },
    "subjectRef": {
      "type": "object",
      "required": ["subject"],
      "properties": {
        "subject": {
          "type": "union",
          "refs": [
            "com.atproto.admin.defs#repoRef",
            "com.atproto.repo.strongRef"
          ]
        },
        "actionType": {
          "type": "string"
        },
        "actionId": {
          "type": "integer"
        }
      }
    },
    "standingRef": {
      "type": "object",
      "required": ["standing"],
      "properties": {
        "standing": {
          "type": "string",
          "knownValues": ["good", "warning", "atRisk"]
        },
        "previousStanding": {
          "type": "string",
          "knownValues": ["good", "warning", "atRisk"]
        }
      }
    }
  }
}

