{
    "table": "lineitems_payments",
    "primary_key": "sales_receipt_id",
    "columns": [
      "sales_receipt_id",
      "org_id",
      "line_items",
      "payments"
    ],
    "required_columns": ["sales_receipt_id"],
    "unique_fields": ["sales_receipt_id"],
    "joins": [
      {
        "type": "left",
        "table": "sales_receipts",
        "first": "lineitems_payments.sales_receipt_id",
        "second": "sales_receipts.sales_receipt_id",
        "operator": "="
      }
    ],
    "additional_columns": [
      {
        "name": "invoiceNumber",
        "source": "sales_receipts.invoiceNumber",
        "type": "text"
      },
      {
        "name": "totalAmount",
        "source": "sales_receipts.totalAmount",
        "type": "numeric"
      }
    ],
    "export_transforms": {
      "line_items": {
        "type": "json_decode",
        "pretty_print": true
      },
      "payments": {
        "type": "json_decode",
        "pretty_print": true
      }
    },
    "import_transforms": {
      "line_items": {
        "type": "json",
        "validate_structure": {
          "array_structure": true,
          "required_fields": ["product_id", "quantity", "unit_price"]
        }
      },
      "payments": {
        "type": "json",
        "validate_structure": {
          "array_structure": true,
          "required_fields": ["method", "amount"]
        }
      }
    },
    "field_labels": {
      "sales_receipt_id": "Receipt ID",
      "org_id": "Organization ID",
      "line_items": "Line Items (JSON)",
      "payments": "Payments (JSON)",
      "invoiceNumber": "Invoice Number",
      "totalAmount": "Total Amount"
    },
    "validation_rules": {
      "sales_receipt_id": {
        "type": "exists",
        "table": "sales_receipts",
        "column": "sales_receipt_id",
        "error_message": "Receipt ID must exist in sales_receipts table"
      },
      "line_items": {
        "type": "json_array",
        "min_items": 1
      }
    }
  }