{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/arcnm-io/json-schema/arcnm-io-parts-list-public-schema.json",
  "title": "PartsListPublic",
  "description": "``PartsPublic`` with per-item ``preview_status`` (additive-only).",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/arcnm-io-parts-api-openapi.yml#/components/schemas/PartsListPublic",
  "properties": {
    "data": {
      "items": {
        "$ref": "#/$defs/PartListItem"
      },
      "type": "array",
      "title": "Data",
      "description": "The page of parts matching the query."
    },
    "count": {
      "type": "integer",
      "title": "Count",
      "description": "Total number of parts matching the query."
    },
    "facets": {
      "anyOf": [
        {
          "additionalProperties": {
            "items": {
              "$ref": "#/$defs/FacetValue"
            },
            "type": "array"
          },
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Facets",
      "description": "Present only when `include_facets` is set. Maps each filter name to its selectable values with counts."
    },
    "next_cursor": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Next Cursor",
      "description": "Position token for the next page — pass it back as `cursor`. Null on the last page, and null under a `sort` that cannot be keyset-paged (see `sort`). Prefer this over `offset`: it is stable while parts are being created."
    },
    "has_more": {
      "type": "boolean",
      "title": "Has More",
      "description": "Whether more parts match beyond this page.",
      "default": false
    }
  },
  "type": "object",
  "required": [
    "data",
    "count"
  ],
  "$defs": {
    "FacetValue": {
      "properties": {
        "value": {
          "type": "string",
          "title": "Value",
          "description": "Value to send back as the filter argument."
        },
        "label": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Label",
          "description": "Display name where the value is an opaque id; else null."
        },
        "count": {
          "type": "integer",
          "title": "Count",
          "description": "Parts matching, given the OTHER active filters."
        }
      },
      "type": "object",
      "required": [
        "value",
        "count"
      ],
      "title": "FacetValue",
      "description": "One selectable filter value and how many parts it would match."
    },
    "PartListItem": {
      "properties": {
        "part_number": {
          "type": "string",
          "maxLength": 64,
          "title": "Part Number",
          "description": "Stable identifier (≈ SAP MATNR). Unique per org."
        },
        "description": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 512
            },
            {
              "type": "null"
            }
          ],
          "title": "Description",
          "description": "Human-readable description of the part."
        },
        "base_uom": {
          "type": "string",
          "maxLength": 16,
          "title": "Base Uom",
          "description": "Base unit of measure for the part (ISO unit code, e.g. EA, KG, M).",
          "default": "EA"
        },
        "make_or_buy": {
          "type": "string",
          "maxLength": 16,
          "title": "Make Or Buy",
          "description": "Whether the part is manufactured in-house ('make') or a catalogue part ('buy'). A component of an assembly is always 'make' here: its sourcing is set in the assembly's parts list.",
          "default": "make"
        },
        "purchase_price": {
          "anyOf": [
            {
              "type": "number",
              "maximum": 10000000.0,
              "minimum": 0.0
            },
            {
              "type": "null"
            }
          ],
          "title": "Purchase Price",
          "description": "Purchase price per piece for a catalogue part, in the part's default currency. Used as the quote for parts marked 'buy'; leave empty to receive a material-floor estimate flagged for review. Not set on a component of an assembly."
        },
        "procurement_type": {
          "type": "string",
          "maxLength": 32,
          "title": "Procurement Type",
          "description": "How the part is sourced (e.g. in-house production or external supplier) — a label to filter the parts list by and to sync with your ERP. It does not change a price: whether a part is priced as a catalogue part or as manufactured follows make_or_buy.",
          "default": "in_house"
        },
        "lead_time_days": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Lead Time Days",
          "description": "Expected lead time to obtain the part, in days."
        },
        "default_currency": {
          "type": "string",
          "maxLength": 3,
          "title": "Default Currency",
          "description": "Default currency for the part's pricing (ISO 4217 code, e.g. EUR, USD).",
          "default": "EUR"
        },
        "id": {
          "type": "string",
          "format": "uuid",
          "title": "Id",
          "description": "Unique identifier of the part."
        },
        "org_id": {
          "type": "string",
          "format": "uuid",
          "title": "Org Id",
          "description": "ID of the organization that owns the part."
        },
        "classification_id": {
          "anyOf": [
            {
              "type": "string",
              "format": "uuid"
            },
            {
              "type": "null"
            }
          ],
          "title": "Classification Id",
          "description": "ID of the classification category this part belongs to, if any."
        },
        "folder_id": {
          "anyOf": [
            {
              "type": "string",
              "format": "uuid"
            },
            {
              "type": "null"
            }
          ],
          "title": "Folder Id",
          "description": "ID of the workspace folder this part is filed in; null is unfiled."
        },
        "attributes": {
          "additionalProperties": true,
          "type": "object",
          "title": "Attributes",
          "description": "Free-form key/value metadata for the part."
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "title": "Created At",
          "description": "Timestamp when the part was created (UTC, ISO 8601)."
        },
        "updated_at": {
          "type": "string",
          "format": "date-time",
          "title": "Updated At",
          "description": "Timestamp when the part was last updated (UTC, ISO 8601)."
        },
        "preview_status": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Preview Status",
          "description": "GLB preview readiness of the part's newest revision's active CAD dataset (e.g. ok, pending, failed) — the same status GET /parts/{id}/preview-url reports; null when the part has no dataset (that endpoint's 'no_dataset')."
        }
      },
      "type": "object",
      "required": [
        "part_number",
        "id",
        "org_id",
        "created_at",
        "updated_at"
      ],
      "title": "PartListItem",
      "description": "A Part in the list projection, plus GLB-preview readiness."
    }
  }
}