{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://tune.toys/schemas/platform/developer-app.schema.json",
  "title": "DeveloperApp",
  "description": "A developer app groups API keys, usage, webhooks and a tier. `tier` is the last observed effective tier, computed from the owner's feature:api.pro grant.",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "id": { "$ref": "common.schema.json#/$defs/EntityId" },
    "ownerAccountId": { "$ref": "common.schema.json#/$defs/EntityId" },
    "publisherId": {
      "anyOf": [
        { "$ref": "common.schema.json#/$defs/EntityId" },
        { "type": "null" }
      ]
    },
    "name": { "type": "string", "minLength": 1, "maxLength": 64 },
    "description": { "type": "string", "maxLength": 500 },
    "homepage": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 2048,
          "pattern": "^https://"
        },
        { "type": "null" }
      ]
    },
    "tier": { "enum": ["free", "pro"] },
    "state": { "enum": ["active", "suspended", "deleted"] },
    "createdAt": { "$ref": "common.schema.json#/$defs/Timestamp" },
    "updatedAt": { "$ref": "common.schema.json#/$defs/Timestamp" },
    "version": { "type": "integer", "minimum": 1 }
  },
  "required": [
    "id",
    "ownerAccountId",
    "publisherId",
    "name",
    "description",
    "homepage",
    "tier",
    "state",
    "createdAt",
    "updatedAt",
    "version"
  ]
}
