{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Palettenreport 1.0.0 – typisierte CSV-Zeile",
  "description": "Nach CSV-Parsing und Zahlen-/JSON-Konvertierung. Summen, eindeutige IDs und Datum ≤ heute zusätzlich über Zod validiert.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "pallet_id",
    "received_date",
    "source",
    "pallet_type",
    "pieces_counted",
    "pieces_a",
    "pieces_b",
    "pieces_c",
    "pieces_defect",
    "category_shares",
    "gross_weight_kg",
    "purchase_tier_price_per_piece",
    "notes",
    "recorded_by",
    "verified_by"
  ],
  "properties": {
    "pallet_id": {
      "type": "string",
      "pattern": "^(?!EXAMPLE-)[A-Za-z0-9_-]+$"
    },
    "received_date": {
      "type": "string",
      "format": "date"
    },
    "source": {
      "enum": [
        "amazon",
        "shein",
        "other"
      ]
    },
    "pallet_type": {
      "enum": [
        "mixed",
        "fashion",
        "electronics",
        "household",
        "other"
      ]
    },
    "category_shares": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "women": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        },
        "men": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        },
        "children": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        },
        "accessories": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        },
        "beauty": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        },
        "electronics": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        },
        "household": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        },
        "other": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        }
      }
    },
    "gross_weight_kg": {
      "type": "number",
      "exclusiveMinimum": 0
    },
    "purchase_tier_price_per_piece": {
      "type": "number",
      "minimum": 0.1,
      "maximum": 500
    },
    "notes": {
      "type": "string"
    },
    "recorded_by": {
      "type": "string",
      "minLength": 2
    },
    "verified_by": {
      "type": "string",
      "minLength": 2
    },
    "pieces_counted": {
      "type": "integer",
      "minimum": 1
    },
    "pieces_a": {
      "type": "integer",
      "minimum": 0
    },
    "pieces_b": {
      "type": "integer",
      "minimum": 0
    },
    "pieces_c": {
      "type": "integer",
      "minimum": 0
    },
    "pieces_defect": {
      "type": "integer",
      "minimum": 0
    }
  }
}
