{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/agstack/json-schema/agstack-farm-schema.json",
  "title": "Farm",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/agstack-farm-api-openapi.yml#/components/schemas/Farm",
  "type": "object",
  "properties": {
    "status": {
      "allOf": [
        {
          "$ref": "#/$defs/StatusEnum"
        }
      ],
      "minimum": -2147483648,
      "maximum": 2147483647
    },
    "deleted_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "readOnly": true
    },
    "updated_at": {
      "type": "string",
      "format": "date-time",
      "readOnly": true
    },
    "id": {
      "type": "string",
      "format": "uuid",
      "readOnly": true
    },
    "name": {
      "type": "string"
    },
    "description": {
      "type": "string"
    },
    "administrator": {
      "type": "string"
    },
    "telephone": {
      "type": "string"
    },
    "vatID": {
      "type": "string"
    },
    "hasAgriParcel": {
      "type": "array",
      "items": {
        "type": "string",
        "format": "uuid"
      },
      "readOnly": true
    },
    "contactPerson": {
      "$ref": "#/$defs/ContactPersonField"
    },
    "address": {
      "$ref": "#/$defs/AddressField"
    }
  },
  "required": [
    "address",
    "administrator",
    "contactPerson",
    "created_at",
    "description",
    "hasAgriParcel",
    "id",
    "name",
    "telephone",
    "updated_at",
    "vatID"
  ],
  "$defs": {
    "AddressField": {
      "type": "object",
      "properties": {
        "adminUnitL1": {
          "type": "string"
        },
        "adminUnitL2": {
          "type": "string"
        },
        "addressArea": {
          "type": "string"
        },
        "municipality": {
          "type": "string"
        },
        "community": {
          "type": "string"
        },
        "locatorName": {
          "type": "string"
        }
      },
      "required": [
        "addressArea",
        "adminUnitL1",
        "adminUnitL2",
        "community",
        "locatorName",
        "municipality"
      ]
    },
    "ContactPersonField": {
      "type": "object",
      "properties": {
        "firstname": {
          "type": "string"
        },
        "lastname": {
          "type": "string"
        }
      },
      "required": [
        "firstname",
        "lastname"
      ]
    },
    "StatusEnum": {
      "enum": [
        0,
        1,
        2
      ],
      "type": "integer",
      "description": "* `0` - Inactive\n* `1` - Active\n* `2` - Deleted"
    }
  }
}