{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/vectelos-com/json-schema/vectelos-com-line-correction-schema.json",
  "title": "LineCorrection",
  "description": "A reviewer's edit to one line. Every field except item_index is optional;\nwhatever is omitted keeps its current value. The reviewer owns the result —\nthe line is stamped reader-supplied and marked as theirs on the PDF, so the\nold 'we only accept a CODE and derive everything from the schedule' guard is\nrelaxed on purpose (the owner asked for full manual control and understands\nthat changing the HTS/rate is their assertion, not ours).\n\nTHE CAPS BELOW MUST NOT BE TIGHTER THAN WHAT THE ANALYZER EMITS. The editor\npre-fills every field from the stored line, so a cap below the analyzer's own\noutput makes \"open the pencil and press save\" fail on a line the reviewer\nnever even changed. That is what happened: `description` was capped at 500\nwhile `AnalyzedLineItem.description` is unbounded, so a long extracted\ndescription 422'd on a no-op save. Caps are kept (unbounded input reaches the\nPDF renderer) but sized above anything the pipeline produces.",
  "x-generated": "2026-11-27",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/vectelos-com-openapi.json#/components/schemas/LineCorrection",
  "properties": {
    "item_index": {
      "type": "integer",
      "title": "Item Index",
      "description": "Which line the reviewer is editing"
    },
    "recompute_from_schedule": {
      "type": "boolean",
      "title": "Recompute From Schedule",
      "description": "Set by the clarification picker, where the reader CHOSE a tariff line rather than asserting a rate: recompute duty and trade remedies from the published schedule for `hts_code`. Default false keeps the settled contract that a bare `hts_code` is a LABEL and does not touch duty. Ignored when `tariff_rate_pct` is supplied -- an explicit rate is always the reviewer's assertion and always wins.",
      "default": false
    },
    "hts_code": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 32
        },
        {
          "type": "null"
        }
      ],
      "title": "Hts Code",
      "description": "HTS code the reviewer assigns (a label; their rate governs the duty)"
    },
    "description": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 2000
        },
        {
          "type": "null"
        }
      ],
      "title": "Description",
      "description": "Reviewer's amended description / note"
    },
    "quantity": {
      "anyOf": [
        {
          "type": "number",
          "minimum": 0.0
        },
        {
          "type": "null"
        }
      ],
      "title": "Quantity"
    },
    "total_value_usd": {
      "anyOf": [
        {
          "type": "number",
          "minimum": 0.0
        },
        {
          "type": "null"
        }
      ],
      "title": "Total Value Usd",
      "description": "Reviewer's customs value for the line"
    },
    "tariff_rate_pct": {
      "anyOf": [
        {
          "type": "number",
          "maximum": 1000.0,
          "minimum": 0.0
        },
        {
          "type": "null"
        }
      ],
      "title": "Tariff Rate Pct",
      "description": "Ad-valorem rate the reviewer applies; duty = value × rate"
    },
    "quantity_unit": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 32
        },
        {
          "type": "null"
        }
      ],
      "title": "Quantity Unit",
      "description": "Unit of the quantity on this line (kg, each, liter, pr, doz, bbl...). Supplied for a specific or compound rate whose duty could not be computed because the invoice did not state one. The published rate still governs; this does not override it."
    }
  },
  "type": "object",
  "required": [
    "item_index"
  ]
}