{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/farmos/json-schema/farmos-asset-request-schema.json",
  "title": "AssetRequest",
  "x-generated": "2026-11-09",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/farmos-assets-api-openapi.yml#/components/schemas/AssetRequest",
  "type": "object",
  "required": [
    "data"
  ],
  "properties": {
    "data": {
      "$ref": "#/$defs/AssetData"
    }
  },
  "$defs": {
    "AssetAttributes": {
      "type": "object",
      "description": "Common attributes shared by all asset types",
      "properties": {
        "drupal_internal__id": {
          "type": "integer",
          "readOnly": true,
          "description": "Internal Drupal integer ID (not for external use)"
        },
        "name": {
          "type": "string",
          "description": "Asset name"
        },
        "status": {
          "type": "string",
          "enum": [
            "active",
            "archived"
          ],
          "description": "Asset status (use archived to retire an asset)"
        },
        "archived": {
          "type": "boolean",
          "description": "Whether the asset is archived (4.x and later)"
        },
        "notes": {
          "type": "object",
          "description": "Free-form notes (rich text)",
          "properties": {
            "value": {
              "type": "string"
            },
            "format": {
              "type": "string"
            }
          }
        },
        "is_location": {
          "type": "boolean",
          "description": "Whether this asset can act as a location for other assets/logs"
        },
        "is_fixed": {
          "type": "boolean",
          "description": "Whether the asset has a fixed geometry (does not move)"
        },
        "intrinsic_geometry": {
          "type": "string",
          "description": "WKT geometry string for fixed-location assets"
        },
        "geometry": {
          "type": "string",
          "description": "Computed current geometry (WKT)"
        },
        "location": {
          "type": "array",
          "description": "Computed current location assets",
          "items": {
            "type": "object"
          }
        },
        "nickname": {
          "type": "array",
          "description": "Alternative names/nicknames for the asset",
          "items": {
            "type": "string"
          }
        },
        "id_tag": {
          "type": "array",
          "description": "Physical identification tags",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "type": {
                "type": "string"
              },
              "location": {
                "type": "string"
              }
            }
          }
        },
        "image": {
          "type": "array",
          "description": "Attached images",
          "items": {
            "type": "object"
          }
        },
        "file": {
          "type": "array",
          "description": "Attached files",
          "items": {
            "type": "object"
          }
        },
        "created": {
          "type": "integer",
          "description": "Unix timestamp when the record was created",
          "readOnly": true
        },
        "changed": {
          "type": "integer",
          "description": "Unix timestamp when the record was last modified",
          "readOnly": true
        }
      }
    },
    "AssetData": {
      "type": "object",
      "required": [
        "type",
        "attributes"
      ],
      "properties": {
        "type": {
          "type": "string",
          "description": "JSON:API resource type (e.g., asset--animal, asset--land)"
        },
        "id": {
          "type": "string",
          "format": "uuid",
          "readOnly": true
        },
        "attributes": {
          "$ref": "#/$defs/AssetAttributes"
        },
        "relationships": {
          "$ref": "#/$defs/AssetRelationships"
        },
        "links": {
          "$ref": "#/$defs/JsonApiLinks"
        }
      }
    },
    "AssetRelationships": {
      "type": "object",
      "description": "Common relationships shared by all asset types",
      "properties": {
        "parent": {
          "$ref": "#/$defs/JsonApiRelationship"
        },
        "location": {
          "$ref": "#/$defs/JsonApiRelationship"
        },
        "image": {
          "$ref": "#/$defs/JsonApiRelationship"
        },
        "file": {
          "$ref": "#/$defs/JsonApiRelationship"
        }
      }
    },
    "JsonApiLinks": {
      "type": "object",
      "properties": {
        "self": {
          "type": "string",
          "format": "uri"
        },
        "related": {
          "type": "string",
          "format": "uri"
        }
      }
    },
    "JsonApiRelationship": {
      "type": "object",
      "properties": {
        "data": {
          "oneOf": [
            {
              "$ref": "#/$defs/JsonApiRelationshipData"
            },
            {
              "type": "array",
              "items": {
                "$ref": "#/$defs/JsonApiRelationshipData"
              }
            },
            {
              "type": [
                "object",
                "null"
              ],
              "maxProperties": 0
            }
          ]
        },
        "links": {
          "$ref": "#/$defs/JsonApiLinks"
        }
      }
    },
    "JsonApiRelationshipData": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string"
        },
        "id": {
          "type": "string",
          "format": "uuid"
        }
      }
    }
  }
}