{
 "type": "object",
 "properties": {
  "accessorials": {
   "type": "object",
   "properties": {
    "codes": {
     "type": "array",
     "items": {
      "enum": [
       "APTD",
       "APTP",
       "COD",
       "EXPD",
       "FVC",
       "GTD_AM",
       "GTD_NOON",
       "GTD_PM",
       "HAZ",
       "IDL",
       "INBD",
       "IPU",
       "LFTD",
       "LFTP",
       "LTDAD",
       "LTDAP",
       "MARK",
       "MNC",
       "OVR",
       "PPD",
       "PSC",
       "PSH",
       "PSN",
       "REP",
       "RES",
       "SRT",
       "SS",
       "TCS"
      ]
     }
    },
    "fullValueCoverageDetails": {
     "type": "object",
     "properties": {
      "currency": {
       "enum": [
        "USD",
        "CAD",
        "MXN"
       ]
      },
      "monetaryValue": {
       "type": "string",
       "pattern": "\\d+.\\d{2}"
      }
     },
     "required": [
      "monetaryValue"
     ]
    },
    "hazardousDetails": {
     "type": "object",
     "properties": {
      "emergencyContact": {
       "type": "object",
       "properties": {
        "name": {
         "type": "string"
        },
        "phone": {
         "type": "string"
        }
       },
       "required": [
        "phone"
       ]
      }
     },
     "required": [
      "emergencyContact"
     ]
    }
   }
  },
  "billTo": {
   "type": "object",
   "properties": {
    "account": {
     "type": "string"
    },
    "address1": {
     "type": "string"
    },
    "address2": {
     "type": "string"
    },
    "city": {
     "type": "string"
    },
    "contact": {
     "type": "object",
     "properties": {
      "email": {
       "type": "string"
      },
      "name": {
       "type": "string"
      },
      "phone": {
       "type": "string"
      }
     },
     "required": [
      "phone"
     ]
    },
    "country": {
     "enum": [
      "USA",
      "CAN",
      "MEX"
     ]
    },
    "locationId": {
     "type": "string"
    },
    "name": {
     "type": "string"
    },
    "postalCode": {
     "type": "string",
     "pattern": "(?:\\d{5}(?:[-]\\d{4})?)|(?:(?:[A-Za-z][0-9][A-Za-z][0-9][A-Za-z])[0-9]?)"
    },
    "stateProvince": {
     "enum": [
      "AL",
      "AK",
      "AZ",
      "AR",
      "CA",
      "CO",
      "CT",
      "DC",
      "DE",
      "FL",
      "GA",
      "HI",
      "ID",
      "IL",
      "IN",
      "IA",
      "KS",
      "KY",
      "LA",
      "ME",
      "MD",
      "MA",
      "MI",
      "MN",
      "MS",
      "MO",
      "MT",
      "NE",
      "NV",
      "NH",
      "NJ",
      "NM",
      "NY",
      "NC",
      "ND",
      "OH",
      "OK",
      "OR",
      "PA",
      "PR",
      "RI",
      "SC",
      "SD",
      "TN",
      "TX",
      "UT",
      "VT",
      "VA",
      "WA",
      "WV",
      "WI",
      "WY",
      "AB",
      "BC",
      "MB",
      "NB",
      "NL",
      "NS",
      "NT",
      "NU",
      "ON",
      "PE",
      "QC",
      "SK",
      "YT",
      "CMX",
      "AGU",
      "BCN",
      "BCS",
      "CAM",
      "COA",
      "COL",
      "CHP",
      "CHH",
      "DUR",
      "GUA",
      "GRO",
      "HID",
      "JAL",
      "MEX",
      "MIC",
      "MOR",
      "NAY",
      "NLE",
      "OAX",
      "PUE",
      "QUE",
      "ROO",
      "SLP",
      "SIN",
      "SON",
      "TAB",
      "TAM",
      "TLA",
      "VER",
      "YUC",
      "ZAC"
     ]
    }
   },
   "required": [
    "address1",
    "city",
    "contact",
    "country",
    "name",
    "postalCode",
    "stateProvince"
   ]
  },
  "bol": {
   "type": "object",
   "properties": {
    "function": {
     "enum": [
      "Create",
      "Modify"
     ]
    },
    "isTest": {
     "type": "boolean"
    },
    "requestedPickupDate": {
     "type": "string",
     "pattern": "\\d{4}-\\d{2}-\\d{2}"
    },
    "requestorRole": {
     "enum": [
      "Shipper",
      "Consignee",
      "Third Party"
     ]
    },
    "specialInstructions": {
     "type": "string"
    }
   },
   "required": [
    "requestorRole"
   ]
  },
  "commodities": {
   "type": "object",
   "properties": {
    "handlingUnits": {
     "type": "array",
     "items": {
      "type": "object",
      "properties": {
       "count": {
        "type": "integer"
       },
       "height": {
        "type": "integer"
       },
       "length": {
        "type": "integer"
       },
       "lineItems": {
        "type": "array",
        "items": {
         "type": "object",
         "properties": {
          "classification": {
           "enum": [
            "50",
            "55",
            "60",
            "65",
            "70",
            "77.5",
            "85",
            "92.5",
            "100",
            "110",
            "125",
            "150",
            "175",
            "200",
            "250",
            "300",
            "400",
            "500"
           ]
          },
          "description": {
           "type": "string"
          },
          "hazardous": {
           "type": "boolean"
          },
          "nmfc": {
           "type": "string",
           "pattern": "\\d+"
          },
          "nmfcSub": {
           "type": "string",
           "pattern": "\\d+"
          },
          "packagingType": {
           "enum": [
            "BAG",
            "BAL",
            "BBL",
            "BSK",
            "BIN",
            "BOX",
            "BXT",
            "BCH",
            "BDL",
            "CAB",
            "CAG",
            "CAN",
            "CBY",
            "CAR",
            "CTN",
            "CAS",
            "CSK",
            "CHS",
            "COL",
            "CNT",
            "COR",
            "CRT",
            "CYL",
            "DRM",
            "DBK",
            "ENV",
            "FIR",
            "GLD",
            "HPR",
            "HGH",
            "HRB",
            "INT",
            "JAR",
            "JCN",
            "KEG",
            "KIT",
            "LIF",
            "LBK",
            "LSE",
            "MXD",
            "OTH",
            "PKG",
            "PCK",
            "PAL",
            "PAT",
            "PCS",
            "PLN",
            "RCK",
            "REL",
            "ROL",
            "SKD",
            "SLP",
            "SPL",
            "TNK",
            "TBN",
            "TRY",
            "TRU",
            "TRK",
            "TUB",
            "TBE",
            "UNT",
            "VPK",
            "WRP"
           ]
          },
          "pieces": {
           "type": "integer"
          },
          "weight": {
           "type": "integer"
          }
         },
         "required": [
          "classification",
          "description",
          "packagingType",
          "pieces",
          "weight"
         ]
        }
       },
       "type": {
        "enum": [
         "BAG",
         "BAL",
         "BBL",
         "BSK",
         "BIN",
         "BOX",
         "BXT",
         "BCH",
         "BDL",
         "CAB",
         "CAG",
         "CAN",
         "CBY",
         "CAR",
         "CTN",
         "CAS",
         "CSK",
         "CHS",
         "COL",
         "CNT",
         "COR",
         "CRT",
         "CYL",
         "DRM",
         "DBK",
         "ENV",
         "FIR",
         "GLD",
         "HPR",
         "HGH",
         "HRB",
         "INT",
         "JAR",
         "JCN",
         "KEG",
         "KIT",
         "LIF",
         "LBK",
         "LSE",
         "MXD",
         "OTH",
         "PKG",
         "PCK",
         "PAL",
         "PAT",
         "PCS",
         "PLN",
         "RCK",
         "REL",
         "ROL",
         "SKD",
         "SLP",
         "SPL",
         "TNK",
         "TBN",
         "TRY",
         "TRU",
         "TRK",
         "TUB",
         "TBE",
         "UNT",
         "VPK",
         "WRP"
        ]
       },
       "weight": {
        "type": "integer"
       },
       "width": {
        "type": "integer"
       }
      },
      "required": [
       "count",
       "type",
       "weight"
      ]
     }
    },
    "lineItemLayout": {
     "enum": [
      "Nested",
      "Stacked"
     ]
    }
   },
   "required": [
    "handlingUnits",
    "lineItemLayout"
   ]
  },
  "destination": {
   "type": "object",
   "properties": {
    "account": {
     "type": "string"
    },
    "address1": {
     "type": "string"
    },
    "address2": {
     "type": "string"
    },
    "city": {
     "type": "string"
    },
    "contact": {
     "type": "object",
     "properties": {
      "email": {
       "type": "string"
      },
      "name": {
       "type": "string"
      },
      "phone": {
       "type": "string"
      }
     },
     "required": [
      "phone"
     ]
    },
    "country": {
     "enum": [
      "USA",
      "CAN",
      "MEX"
     ]
    },
    "locationId": {
     "type": "string"
    },
    "name": {
     "type": "string"
    },
    "postalCode": {
     "type": "string",
     "pattern": "(?:\\d{5}(?:[-]\\d{4})?)|(?:(?:[A-Za-z][0-9][A-Za-z][0-9][A-Za-z])[0-9]?)"
    },
    "stateProvince": {
     "enum": [
      "AL",
      "AK",
      "AZ",
      "AR",
      "CA",
      "CO",
      "CT",
      "DC",
      "DE",
      "FL",
      "GA",
      "HI",
      "ID",
      "IL",
      "IN",
      "IA",
      "KS",
      "KY",
      "LA",
      "ME",
      "MD",
      "MA",
      "MI",
      "MN",
      "MS",
      "MO",
      "MT",
      "NE",
      "NV",
      "NH",
      "NJ",
      "NM",
      "NY",
      "NC",
      "ND",
      "OH",
      "OK",
      "OR",
      "PA",
      "PR",
      "RI",
      "SC",
      "SD",
      "TN",
      "TX",
      "UT",
      "VT",
      "VA",
      "WA",
      "WV",
      "WI",
      "WY",
      "AB",
      "BC",
      "MB",
      "NB",
      "NL",
      "NS",
      "NT",
      "NU",
      "ON",
      "PE",
      "QC",
      "SK",
      "YT",
      "CMX",
      "AGU",
      "BCN",
      "BCS",
      "CAM",
      "COA",
      "COL",
      "CHP",
      "CHH",
      "DUR",
      "GUA",
      "GRO",
      "HID",
      "JAL",
      "MEX",
      "MIC",
      "MOR",
      "NAY",
      "NLE",
      "OAX",
      "PUE",
      "QUE",
      "ROO",
      "SLP",
      "SIN",
      "SON",
      "TAB",
      "TAM",
      "TLA",
      "VER",
      "YUC",
      "ZAC"
     ]
    }
   },
   "required": [
    "address1",
    "city",
    "contact",
    "country",
    "name",
    "postalCode",
    "stateProvince"
   ]
  },
  "origin": {
   "type": "object",
   "properties": {
    "account": {
     "type": "string"
    },
    "address1": {
     "type": "string"
    },
    "address2": {
     "type": "string"
    },
    "city": {
     "type": "string"
    },
    "contact": {
     "type": "object",
     "properties": {
      "email": {
       "type": "string"
      },
      "name": {
       "type": "string"
      },
      "phone": {
       "type": "string"
      }
     },
     "required": [
      "phone"
     ]
    },
    "country": {
     "enum": [
      "USA",
      "CAN",
      "MEX"
     ]
    },
    "locationId": {
     "type": "string"
    },
    "name": {
     "type": "string"
    },
    "postalCode": {
     "type": "string",
     "pattern": "(?:\\d{5}(?:[-]\\d{4})?)|(?:(?:[A-Za-z][0-9][A-Za-z][0-9][A-Za-z])[0-9]?)"
    },
    "stateProvince": {
     "enum": [
      "AL",
      "AK",
      "AZ",
      "AR",
      "CA",
      "CO",
      "CT",
      "DC",
      "DE",
      "FL",
      "GA",
      "HI",
      "ID",
      "IL",
      "IN",
      "IA",
      "KS",
      "KY",
      "LA",
      "ME",
      "MD",
      "MA",
      "MI",
      "MN",
      "MS",
      "MO",
      "MT",
      "NE",
      "NV",
      "NH",
      "NJ",
      "NM",
      "NY",
      "NC",
      "ND",
      "OH",
      "OK",
      "OR",
      "PA",
      "PR",
      "RI",
      "SC",
      "SD",
      "TN",
      "TX",
      "UT",
      "VT",
      "VA",
      "WA",
      "WV",
      "WI",
      "WY",
      "AB",
      "BC",
      "MB",
      "NB",
      "NL",
      "NS",
      "NT",
      "NU",
      "ON",
      "PE",
      "QC",
      "SK",
      "YT",
      "CMX",
      "AGU",
      "BCN",
      "BCS",
      "CAM",
      "COA",
      "COL",
      "CHP",
      "CHH",
      "DUR",
      "GUA",
      "GRO",
      "HID",
      "JAL",
      "MEX",
      "MIC",
      "MOR",
      "NAY",
      "NLE",
      "OAX",
      "PUE",
      "QUE",
      "ROO",
      "SLP",
      "SIN",
      "SON",
      "TAB",
      "TAM",
      "TLA",
      "VER",
      "YUC",
      "ZAC"
     ]
    }
   },
   "required": [
    "address1",
    "city",
    "contact",
    "country",
    "name",
    "postalCode",
    "stateProvince"
   ]
  },
  "payment": {
   "type": "object",
   "properties": {
    "terms": {
     "enum": [
      "Prepaid",
      "Collect",
      "Third Party"
     ]
    }
   },
   "required": [
    "terms"
   ]
  },
  "referenceNumbers": {
   "type": "object",
   "properties": {
    "additionalReferences": {
     "type": "array",
     "items": {
      "type": "object",
      "properties": {
       "name": {
        "type": "string"
       },
       "value": {
        "type": "string"
       }
      },
      "required": [
       "name",
       "value"
      ]
     }
    },
    "bol": {
     "type": "array",
     "items": {
      "type": "string"
     }
    },
    "manifestId": {
     "type": "string"
    },
    "masterBol": {
     "type": "string"
    },
    "po": {
     "type": "array",
     "items": {
      "type": "object",
      "properties": {
       "additionalShipperInfo": {
        "type": "string"
       },
       "number": {
        "type": "string"
       },
       "palletized": {
        "type": "boolean"
       },
       "pieces": {
        "type": "integer"
       },
       "weight": {
        "type": "integer"
       },
       "weightUnit": {
        "enum": [
         "Pounds",
         "Kilograms"
        ]
       }
      }
     }
    },
    "pro": {
     "type": "string"
    },
    "quoteId": {
     "type": "string"
    },
    "shipmentId": {
     "type": "string"
    },
    "trailerId": {
     "type": "string"
    }
   },
   "required": []
  },
  "shipmentTotals": {
   "type": "object",
   "properties": {
    "handlingUnits": {
     "type": "integer"
    }
   }
  },
  "version": {
   "enum": [
    "v2.1.0"
   ]
  }
 },
 "required": [
  "billTo",
  "bol",
  "commodities",
  "destination",
  "origin",
  "payment",
  "version"
 ]
}