{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/samva-dev/json-schema/samva-dev-custom-field-list-schema.json",
  "title": "CustomFieldList",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/samva-dev-custom-fields-api-openapi.yml#/components/schemas/CustomFieldList",
  "type": "object",
  "properties": {
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "$ref": "#/$defs/CustomFieldDefinitionId"
          },
          "organizationId": {
            "$ref": "#/$defs/OrganizationId"
          },
          "key": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "text",
              "number",
              "boolean",
              "date",
              "select"
            ]
          },
          "options": {
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "defaultValue": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "isRequired": {
            "type": "boolean"
          },
          "sortOrder": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "createdAt": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "organizationId",
          "key",
          "label",
          "type",
          "options",
          "defaultValue",
          "isRequired",
          "sortOrder",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "maxItems": 100
    }
  },
  "required": [
    "items"
  ],
  "additionalProperties": false,
  "$defs": {
    "CustomFieldDefinitionId": {
      "type": "string",
      "pattern": "^cfield_[0-9a-hjkmnp-tv-z]{16,24}$",
      "x-samva-brand": "CustomFieldDefinitionId"
    },
    "OrganizationId": {
      "type": "string",
      "pattern": "^org_[0-9a-hjkmnp-tv-z]{16,24}$",
      "x-samva-brand": "OrganizationId"
    }
  }
}