{
  "$id": "https://schema.nfh.global/LogisticsFareBreakup/v2.0",
  "x-iri": "https://schema.nfh.global/LogisticsFareBreakup/v2.0",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "LogisticsFareBreakup JSON Schema",
  "type": "object",
  "properties": {
    "components": {
      "type": "object",
      "properties": {
        "schemas": {
          "type": "object",
          "properties": {
            "LogisticsFareBreakup": {
              "$ref": "#/$defs/LogisticsFareBreakup"
            }
          },
          "additionalProperties": false
        }
      },
      "required": [
        "schemas"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "components"
  ],
  "additionalProperties": false,
  "$defs": {
    "LogisticsFareBreakup": {
      "type": "object",
      "title": "LogisticsFareBreakup",
      "description": "A single line item in the fare breakup for a logistics service.",
      "required": [
        "title",
        "amount"
      ],
      "properties": {
        "title": {
          "type": "string",
          "description": "Name of the fare component",
          "example": "Base Freight"
        },
        "amount": {
          "type": "number",
          "example": 450
        },
        "currency": {
          "type": "string",
          "example": "INR"
        },
        "type": {
          "type": "string",
          "enum": [
            "ITEM",
            "SURCHARGE",
            "TAX",
            "DISCOUNT",
            "FEE"
          ],
          "example": "ITEM"
        },
        "taxBreakup": {
          "type": "array",
          "description": "Tax sub-components if applicable",
          "items": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "example": "CGST @ 9%"
              },
              "percent": {
                "type": "number",
                "example": 9
              },
              "amount": {
                "type": "number",
                "example": 40.5
              }
            }
          }
        },
        "waived": {
          "type": "boolean",
          "description": "Whether this component was waived",
          "example": false
        }
      }
    }
  }
}
