{
  "$id": "https://schema.nfh.global/LogisticsFare/v2.0",
  "x-iri": "https://schema.nfh.global/LogisticsFare/v2.0",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "LogisticsFare JSON Schema",
  "type": "object",
  "properties": {
    "components": {
      "type": "object",
      "properties": {
        "schemas": {
          "type": "object",
          "properties": {
            "LogisticsFare": {
              "$ref": "#/$defs/LogisticsFare"
            }
          },
          "additionalProperties": false
        }
      },
      "required": [
        "schemas"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "components"
  ],
  "additionalProperties": false,
  "$defs": {
    "LogisticsFare": {
      "type": "object",
      "title": "LogisticsFare",
      "description": "Total cost charged for a logistics service including base freight, surcharges, taxes.",
      "required": [
        "currency",
        "totalAmount"
      ],
      "properties": {
        "currency": {
          "type": "string",
          "example": "INR"
        },
        "baseFreight": {
          "type": "number",
          "description": "Base freight charge",
          "example": 450
        },
        "fuelSurcharge": {
          "type": "number",
          "example": 45
        },
        "odaSurcharge": {
          "type": "number",
          "description": "Out of Delivery Area surcharge",
          "example": 0
        },
        "codCharge": {
          "type": "number",
          "description": "Cash on delivery charge",
          "example": 30
        },
        "insuranceCharge": {
          "type": "number",
          "example": 25
        },
        "gst": {
          "type": "number",
          "description": "GST amount",
          "example": 81
        },
        "otherCharges": {
          "type": "number",
          "example": 0
        },
        "discount": {
          "type": "number",
          "example": 50
        },
        "totalAmount": {
          "type": "number",
          "description": "Final total payable",
          "example": 581
        },
        "breakup": {
          "type": "array",
          "description": "Detailed fare breakup line items",
          "items": {
            "$ref": "https://schema.nfh.global/LogisticsFareBreakup/v2.0/schema.json"
          }
        },
        "estimatedFare": {
          "type": "boolean",
          "description": "Whether this is an estimate or confirmed fare",
          "example": false
        },
        "paymentMode": {
          "type": "string",
          "enum": [
            "PREPAID",
            "COD",
            "TO_PAY",
            "CREDIT"
          ],
          "example": "PREPAID"
        }
      }
    }
  }
}
