{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/derive-to/json-schema/derive-to-collection-schema.json",
  "title": "Collection",
  "x-generated": "2026-11-05",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/derive-to-openapi.json#/components/schemas/Collection",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "title": {
      "type": "string"
    },
    "created_by": {
      "type": "string",
      "description": "Creator's user id (\"anon\" if created anonymously)."
    },
    "created_at": {
      "type": "string"
    },
    "count": {
      "type": "number",
      "description": "Number of artifacts in the collection."
    },
    "workspace_access": {
      "type": "string",
      "enum": [
        "none",
        "member"
      ],
      "description": "Workspace share scope: \"member\" (all members) or \"none\" (invite-only)."
    },
    "link_role": {
      "type": "string",
      "enum": [
        "none",
        "viewer",
        "commenter",
        "editor"
      ],
      "description": "What merely holding the canonical collection link grants."
    },
    "password_protected": {
      "type": "boolean",
      "description": "Whether the collection world link requires a password."
    },
    "url": {
      "type": "string",
      "description": "Canonical share URL for this collection."
    },
    "my_role": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "viewer",
        "commenter",
        "editor",
        "owner",
        null
      ],
      "description": "Caller's effective role on the collection. Null if none."
    },
    "can_share": {
      "type": "boolean",
      "description": "Whether the caller has standing (not merely a world-link role) to change collection sharing."
    },
    "starred": {
      "type": "boolean",
      "description": "Whether the caller starred this collection — it pins to their sidebar."
    },
    "last_activity": {
      "type": "string"
    },
    "my_last_activity": {
      "type": "string"
    },
    "preview": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "short_id": {
            "type": "string"
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "current_version": {
            "type": "number"
          },
          "has_preview": {
            "type": "boolean"
          },
          "updated_at": {
            "type": "string"
          },
          "author_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "author_login": {
            "type": [
              "string",
              "null"
            ]
          },
          "author_avatar": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "short_id",
          "title",
          "current_version",
          "has_preview",
          "updated_at",
          "author_name",
          "author_login",
          "author_avatar"
        ]
      },
      "description": "A few of the collection's most recent artifacts, for the filmstrip the Collections view renders. A preview strip, not a listing."
    },
    "active": {
      "type": "boolean",
      "description": "Whether the caller has worked in this collection recently — published, commented, or been added. Derived from acts that leave a row; reading is not recorded."
    }
  },
  "required": [
    "id",
    "title",
    "created_by",
    "created_at",
    "count"
  ]
}