{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/loadsmart/json-schema/loadsmart-custom-form-data-schema.json",
  "title": "CustomFormData",
  "x-generated": "2026-10-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/loadsmart-custom-forms-data-api-openapi.yml#/components/schemas/CustomFormData",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "The unique identifier of the record",
      "readOnly": true
    },
    "createDateTime": {
      "format": "date-time",
      "type": "string",
      "description": "The date and time when the record was created",
      "readOnly": true
    },
    "createdBy": {
      "type": "object",
      "description": "The ID of the user who created the record",
      "readOnly": true
    },
    "lastChangedDateTime": {
      "format": "date-time",
      "type": "string",
      "description": "The date and time when the record was last changed",
      "readOnly": true
    },
    "objectId": {
      "type": "string",
      "description": "The ID of the object that this data belongs to, the type is dependent on the entityName"
    },
    "entityName": {
      "$ref": "#/$defs/CustomFormDataEntitiesEnum"
    },
    "label": {
      "type": "string",
      "description": "The label of the field used at the moment of the data submission"
    },
    "value": {
      "type": "object",
      "description": "The value of this field, entered by the user, store as string, but validated as the Field type"
    },
    "type": {
      "$ref": "#/$defs/CustomFieldType"
    },
    "formFieldId": {
      "type": "object",
      "description": "The ID of the FormField that this data refers to"
    },
    "triggerId": {
      "type": "object",
      "description": "The ID of the Trigger that this data refers to"
    },
    "warehouseId": {
      "type": "object",
      "description": "The ID of the Warehouse that this data refers to"
    }
  },
  "required": [
    "id",
    "createDateTime",
    "createdBy",
    "lastChangedDateTime",
    "objectId",
    "entityName",
    "label",
    "value",
    "type",
    "formFieldId",
    "triggerId",
    "warehouseId"
  ],
  "$defs": {
    "CustomFieldType": {
      "type": "string",
      "description": "The type of the field used at the moment of the data submission, used to render the field in the UI and validate the data on the API level",
      "enum": [
        "str",
        "bigstr",
        "date",
        "bool",
        "doc",
        "multidoc",
        "int",
        "email",
        "phone",
        "dropdown",
        "dropdownmultiselect",
        "combobox",
        "timestamp",
        "action"
      ]
    },
    "CustomFormDataEntitiesEnum": {
      "type": "string",
      "description": "The entity name of the object that this data belongs to",
      "enum": [
        "appointment",
        "assetvisit",
        "assetcontainer"
      ]
    }
  }
}