{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/assignar/json-schema/assignar-document-schema.json",
  "title": "Document",
  "description": "A document definition in the tenant's catalog. Attach one to an asset or a project by its `id`; the catalog itself is read-only.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/assignar-documents-api-openapi.yml#/components/schemas/Document",
  "type": "object",
  "readOnly": true,
  "properties": {
    "id": {
      "type": "integer"
    },
    "type": {
      "type": "integer",
      "description": "The document type id, which determines what the definition requires (expiry date, attachment, or number and expiry)."
    },
    "name": {
      "type": "string"
    },
    "public": {
      "type": "boolean"
    },
    "attachment": {
      "type": "string",
      "description": "Template or blank form held against the definition itself, if any."
    },
    "attachment_url": {
      "allOf": [
        {
          "$ref": "#/$defs/UrlAttachment"
        }
      ],
      "description": "Signed download URL, valid for two hours. Null when the definition has no attachment."
    },
    "tags": {
      "type": "array",
      "description": "Collection of tags applied to the document definition. Always present, and empty when the definition has no tags. Read-only here: the catalog does not accept writes, so there is no request-body counterpart.",
      "items": {
        "$ref": "#/$defs/TagPart"
      }
    }
  },
  "$defs": {
    "TagPart": {
      "title": "TagPart",
      "x-stoplight": {
        "id": "epsk9hslhfq0q"
      },
      "type": "object",
      "description": "",
      "properties": {
        "tag_id": {
          "type": "integer",
          "description": "Identifier of the tag"
        },
        "name": {
          "type": "string",
          "description": "Name of the tag"
        },
        "description": {
          "type": [
            "string",
            "null"
          ],
          "description": "Description of the tag"
        },
        "color": {
          "type": [
            "string",
            "null"
          ],
          "description": "Color to render the tag formated as Hex color code. Ex #0000FF"
        }
      },
      "required": [
        "name"
      ]
    },
    "UrlAttachment": {
      "type": "object",
      "readOnly": true,
      "properties": {
        "url": {
          "type": "string",
          "format": "url",
          "description": "Download URL for the file."
        },
        "expiry": {
          "type": "integer",
          "description": "Expiry date of the download url in timestamp."
        }
      }
    }
  }
}