{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/trimble/json-schema/trimble-data-imp-est-materials-v2-with-keys-schema.json",
  "title": "data_imp_est_materials_v2_withKeys",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/trimble-vista-pm-openapi.yml#/components/schemas/data_imp_est_materials_v2_withKeys",
  "allOf": [
    {
      "type": "object",
      "properties": {
        "__ryvitKeys": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Array of key paths that can be used to retrieve this object."
        },
        "__modifiedUTC": {
          "type": "string",
          "description": "UTC timestamp of when this object was last modified in the cache."
        }
      }
    },
    {
      "$ref": "#/$defs/data_imp_est_materials_v2"
    }
  ],
  "$defs": {
    "data_imp_est_materials_v2": {
      "required": [
        "PMCo",
        "ImportId",
        "Sequence",
        "PhaseGroup",
        "MatlGroup",
        "VendorGroup",
        "KeyID"
      ],
      "type": "object",
      "properties": {
        "PMCo": {
          "maximum": 255,
          "minimum": 1,
          "type": "integer",
          "description": "PM company. Key to pm/projects(PMCo, Project)."
        },
        "ImportId": {
          "maxLength": 10,
          "type": "string",
          "description": "Import ID grouping staged estimate rows for a single import/upload workflow."
        },
        "Sequence": {
          "type": "integer",
          "description": "Line sequence within the import. Key component with PMCo and ImportId."
        },
        "Item": {
          "maxLength": 16,
          "type": [
            "string",
            "null"
          ],
          "description": "Contract item assigned to the material line."
        },
        "PhaseGroup": {
          "type": "integer",
          "description": "Phase group. Key to jc/cost_types(PhaseGroup, CostType)."
        },
        "Phase": {
          "maxLength": 20,
          "type": [
            "string",
            "null"
          ],
          "description": "Project phase for the material line."
        },
        "CostType": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Cost type for the material line."
        },
        "MatlGroup": {
          "type": "integer",
          "description": "Material group. Key to hq/materials(MatlGroup, Material)."
        },
        "Material": {
          "maxLength": 20,
          "type": [
            "string",
            "null"
          ],
          "description": "Material code."
        },
        "MatlDescription": {
          "maxLength": 60,
          "type": [
            "string",
            "null"
          ],
          "description": "Material description."
        },
        "VendorGroup": {
          "type": "integer",
          "description": "Vendor group."
        },
        "Vendor": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Vendor number."
        },
        "UM": {
          "maxLength": 3,
          "type": [
            "string",
            "null"
          ],
          "description": "Unit of measure."
        },
        "Units": {
          "pattern": "^[-+]?[0-9]{1,9}(?:.[0-9]{0,3})?$",
          "type": [
            "string",
            "null"
          ],
          "description": "Material units (numeric(12,3))."
        },
        "UnitCost": {
          "pattern": "^[-+]?[0-9]{1,11}(?:.[0-9]{0,5})?$",
          "type": [
            "string",
            "null"
          ],
          "description": "Unit cost."
        },
        "ECM": {
          "maxLength": 1,
          "type": [
            "string",
            "null"
          ],
          "description": "Equipment / cost / material flag (E, C, or M)."
        },
        "Amount": {
          "pattern": "^[-+]?[0-9]{1,10}(?:.[0-9]{0,2})?$",
          "type": [
            "string",
            "null"
          ],
          "description": "Material amount."
        },
        "ImportItem": {
          "maxLength": 30,
          "type": [
            "string",
            "null"
          ],
          "description": "Imported contract item code from the source estimate file."
        },
        "ImportPhase": {
          "maxLength": 30,
          "type": [
            "string",
            "null"
          ],
          "description": "Imported phase code from the source estimate file."
        },
        "ImportCostType": {
          "maxLength": 30,
          "type": [
            "string",
            "null"
          ],
          "description": "Imported cost type from the source estimate file."
        },
        "ImportMaterial": {
          "maxLength": 30,
          "type": [
            "string",
            "null"
          ],
          "description": "Imported material code from the source estimate file."
        },
        "ImportVendor": {
          "maxLength": 30,
          "type": [
            "string",
            "null"
          ],
          "description": "Imported vendor code from the source estimate file."
        },
        "ImportUM": {
          "maxLength": 30,
          "type": [
            "string",
            "null"
          ],
          "description": "Imported unit of measure from the source estimate file."
        },
        "ImportMisc1": {
          "maxLength": 30,
          "type": [
            "string",
            "null"
          ],
          "description": "Imported misc field 1 from the source estimate file."
        },
        "ImportMisc2": {
          "maxLength": 30,
          "type": [
            "string",
            "null"
          ],
          "description": "Imported misc field 2 from the source estimate file."
        },
        "ImportMisc3": {
          "maxLength": 30,
          "type": [
            "string",
            "null"
          ],
          "description": "Imported misc field 3 from the source estimate file."
        },
        "Errors": {
          "maxLength": 255,
          "type": [
            "string",
            "null"
          ],
          "description": "Validation error text surfaced by Vista for this staged row."
        },
        "Notes": {
          "type": [
            "string",
            "null"
          ],
          "description": "Material line notes."
        },
        "MatlOption": {
          "maxLength": 1,
          "type": [
            "string",
            "null"
          ],
          "description": "Material option flag."
        },
        "RecvYN": {
          "maxLength": 1,
          "type": [
            "string",
            "null"
          ],
          "description": "Received flag."
        },
        "Location": {
          "maxLength": 10,
          "type": [
            "string",
            "null"
          ],
          "description": "Inventory location."
        },
        "TaxGroup": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Tax group."
        },
        "TaxCode": {
          "maxLength": 10,
          "type": [
            "string",
            "null"
          ],
          "description": "Tax code."
        },
        "TaxType": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Tax type."
        },
        "SendFlag": {
          "maxLength": 1,
          "type": [
            "string",
            "null"
          ],
          "description": "Send/interface flag."
        },
        "MSCo": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Material sales company."
        },
        "Quote": {
          "maxLength": 10,
          "type": [
            "string",
            "null"
          ],
          "description": "Quote reference."
        },
        "INCo": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Inventory company."
        },
        "Supplier": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Supplier number."
        },
        "UniqueAttchID": {
          "maxLength": 36,
          "minLength": 36,
          "pattern": "[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}",
          "type": [
            "string",
            "null"
          ],
          "description": "Attachment group ID."
        },
        "KeyID": {
          "type": "integer",
          "description": "Surrogate primary key (bigint)."
        },
        "__custom_fields": {
          "type": "object",
          "description": "Present when custom fields are defined for PMWM in Vista."
        }
      }
    }
  }
}