{
 "type": "object",
 "properties": {
  "accessorials": {
   "type": "object",
   "properties": {
    "appointmentDetails": {
     "type": "object",
     "properties": {
      "pickup": {
       "type": "object",
       "properties": {
        "end": {
         "type": "string",
         "pattern": "\\d{4}-\\d{2}-\\d{2}(?:T\\d{2}:\\d{2}:\\d{2}(?:[.]\\d{3})?)?"
        },
        "start": {
         "type": "string",
         "pattern": "\\d{4}-\\d{2}-\\d{2}(?:T\\d{2}:\\d{2}:\\d{2}(?:[.]\\d{3})?)?"
        }
       }
      }
     },
     "required": [
      "pickup"
     ]
    },
    "codes": {
     "type": "array",
     "items": {
      "enum": [
       "IDL",
       "IPU",
       "LFTD",
       "LFTP",
       "PSC",
       "REP",
       "RES",
       "DCF",
       "DID",
       "DLG",
       "DNC",
       "DSH",
       "DST",
       "GUR",
       "OCF",
       "OIP",
       "OLG",
       "PFF",
       "RSD",
       "RSO"
      ]
     }
    }
   }
  },
  "billTo": {
   "type": "object",
   "properties": {
    "name": {
     "type": "string"
    },
    "contact": {
     "type": "object",
     "properties": {
      "email": {
       "type": "string"
      },
      "name": {
       "type": "string"
      },
      "phone": {
       "type": "string"
      },
      "phoneExt": {
       "type": "string"
      }
     },
     "required": [
      "phone"
     ]
    }
   },
   "description": "contact information for the requestor",
   "required": [
    "contact"
   ]
  },
  "pickup": {
   "type": "object",
   "properties": {
    "function": {
     "enum": [
      "Modify"
     ]
    },
    "isTest": {
     "type": "boolean"
    },
    "requestedPickupDate": {
     "type": "string",
     "pattern": "\\d{4}-\\d{2}-\\d{2}"
    },
    "requestorRole": {
     "enum": [
      "Shipper",
      "Consignee",
      "Third Party"
     ]
    },
    "specialInstructions": {
     "type": "string"
    }
   },
   "required": [
    "function",
    "requestedPickupDate",
    "requestorRole"
   ]
  },
  "commodities": {
   "type": "object",
   "properties": {
    "handlingUnits": {
     "type": "array",
     "items": {
      "type": "object",
      "properties": {
       "destinationPostalCode": {
        "type": "string",
        "pattern": "(?:\\d{5}(?:[-]\\d{4})?)|(?:(?:[A-Za-z][0-9][A-Za-z][0-9][A-Za-z])[0-9]?)"
       },
       "pro": {
        "type": "string"
       },
       "lineItems": {
        "type": "array",
        "items": {
         "type": "object",
         "properties": {
          "hazardous": {
           "type": "boolean"
          },
          "pallets": {
           "type": "integer",
           "description": "number of pallets"
          },
          "pieces": {
           "type": "integer",
           "description": "loose pieces"
          },
          "weight": {
           "type": "integer"
          },
          "weightUnit": {
           "enum": [
            "Pounds",
            "Lbs"
           ]
          }
         },
         "required": [
          "weight"
         ]
        }
       }
      },
      "required": [
       "lineItems"
      ]
     }
    }
   },
   "required": [
    "handlingUnits"
   ]
  },
  "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"
      },
      "phoneExt": {
       "type": "string"
      }
     },
     "required": [
      "phone"
     ]
    },
    "country": {
     "enum": [
      "USA",
      "CAN",
      "US",
      "CN"
     ]
    },
    "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"
   ]
  },
  "referenceNumbers": {
   "type": "object",
   "properties": {
    "additionalReferences": {
     "type": "array",
     "items": {
      "type": "object",
      "properties": {
       "name": {
        "enum": [
         "confirmationNbr",
         "pickupId"
        ]
       },
       "value": {
        "type": "string"
       }
      },
      "required": [
       "name",
       "value"
      ]
     }
    }
   }
  },
  "shipmentTotals": {
   "type": "object",
   "properties": {
    "grossWeight": {
     "type": "integer"
    },
    "handlingUnits": {
     "type": "integer",
     "description": "total number of pallets"
    }
   }
  }
 },
 "required": [
  "billTo",
  "pickup",
  "commodities",
  "origin"
 ]
}