Skip to content

NewOrderRequest

Details for Order JSON schema. Conditional constraints (enforced in backend): If defaultBillToKey, defaultOrderedByKey, or defaultShipToKey are null, corresponding keys must be set on each line item. If defaultBillToKey, defaultOrderedByKey, or defaultShipToKey are not null, they must match a key in billTos, orderedBys, or shipTos respectively. OfferLineNumber, productLineNumber, and componentLineNumber values must be unique within their collections if provided.

Properties

  • orderId (string)Unique ID for order within order management system (system where order lifecycle will be managed). Required, must not be null or empty.
  • referenceId (['string', 'null'])
  • accessGroups (['array', 'null'])

    • Items (string)
  • affiliateIdentifier (['string', 'null'])Unique ID for affiliate within source system (system where order was originally placed).

  • affiliateName (['string', 'null'])Name for affiliate within source system (system where order was originally placed).
  • billTosBill to addresses array for Order. Required, must not be empty. Each item must have required address fields and a non-null key.

    • One of

      • null
      • arrayLength must be at least 1.

        • Items (object)Cannot contain additional properties.

          • address1 (string, required)Address line 1 for address.
          • address2 (['string', 'null'])Address line 2 for address.
          • address3 (['string', 'null'])Address line 3 for address.
          • addressCode (['string', 'null'])Address code for address.
          • city (string, required)City name for address.
          • company (['string', 'null'])Company name for address.
          • country (string, required)Country name for address.
          • emailAddress (['string', 'null'])Contact email address for address.
          • faxNumber (['string', 'null'])Fax number for address.
          • key (string, required)Unique ID for individual contact.
          • name (string, required)Contact name for this address.
          • phoneNumber (['string', 'null'])Phone number for address.
          • postalCode (string, required)Postal code for address.
          • stateProvince (string, required)State or province name for address.
  • costCenter (['string', 'null'])

  • createDateTime (['string', 'null'])Datetime of when order was created.
  • creditCardFee (['number', 'null'], format: double)Credit card transaction fee applied to Order. Minimum: 0.
  • defaultBillToKey (['string', 'null'])Unique ID for default billing contact details pulled from Order.BillTos.Key property (Only if applicable. Otherwise DefaultBillToKey will be null/empty value) (NOTE: If this value is not set, BillToKey must be set on all line items.).
  • defaultOrderedByKey (['string', 'null'])Unique ID for default ordered by contact details pulled from Order.OrderedBy.Key property (Only if applicable. Otherwise DefaultOrderedByKey will be null/empty value).
  • defaultShipToKey (['string', 'null'])Unique ID for default ship to contact pulled from Order.ShipTos.Key property (Only if applicable. Otherwise DefaultShipToKey will be null/empty value) (NOTE: If this value is not set, ShipToKey must be set on all line items.).
  • dueDate (['string', 'null'])Datetime of expected due date for Order. If present, must be a valid date and not in the past (enforced in backend).
  • lineItems (['array'])Order level line item details. Required, must not be empty. Each item must have offerId, quantityOrdered > 0, price >= 0, taxAmount >= 0, lineItemFee >= 0. If defaultBillToKey, defaultOrderedByKey, or defaultShipToKey are null, corresponding keys must be set on each line item. Length must be at least 1.

    • Items (object)Order level line item details. Cannot contain additional properties.

      • Any of

          • offerId (string, required)
          • offerNumber (string, required)
      • offerId (string)Unique ID for offer within Integration Broker.

      • referenceId (['string', 'null'])
      • variableTemplatePrintId (['string', 'null'])Unique ID for variable template file associated to offer on individual line item.
      • additionalProperties (['array', 'null'])Additional properties details for Order LineItems.

        • Items (object)Order.LineItems level additional properties details. Cannot contain additional properties.

          • key (['string', 'null'], required)
          • value (['string', 'null'], required)
      • billToKey (['string', 'null'])Unique ID for Order.BillTos.Key property associated to individual line item (NOTE: If top-level DefaultBillToKey is not set, this must be.).

      • comment (['string', 'null'])Manually entered comment for individual line item.
      • costCenter (['string', 'null'])
      • dueDate (['string', 'null'])Datetime of expected due date for individual line item.
      • lineItemFee (number, format: double, required)Fee applied to individual line item.
      • offerDescription (['string', 'null'])Description for offer within product management system (system where ordered line item products will be managed).
      • offerLineNumber (['string', 'null'])Unique ID for individual line item.
      • offerNumber (['string', 'null'])Name for offer within product management system (system where ordered line item products will be managed).
      • orderedByKey (['string', 'null'])Unique ID for Order.OrderedBy.Key property associated to individual line item.
      • poNumber (['string', 'null'])Purchase order number for individual line item.
      • price (number, format: double, required)Total offer price of individual line item.
      • products (['array', 'null'])

        • Items (object)Cannot contain additional properties.

          • productId (string, required)
          • associatedFileName (['string', 'null'])
          • color (['string', 'null'])
          • comment (['string', 'null'])
          • components (['array', 'null'])

            • Items (object)Product component details. Cannot contain additional properties.

              • productId (string, required)Unique ID for component product within Integration Broker.
              • associatedFileName (['string', 'null'])Name of file associated to component product (if applicable).
              • color (['string', 'null'])Color of component product.
              • comment (['string', 'null'])Manually entered comment for component product.
              • componentLineNumber (['string', 'null'])Unique ID for component product within parent product.
              • productDescription (['string', 'null'])Description for component product within product management system (system where ordered line item products will be managed).
              • productNumber (['string', 'null'])Name for component product within product management system (system where ordered line item products will be managed).
              • productOwner (['string', 'null'])Owner of component product.
              • quantityBackordered (['integer', 'null'], format: int32)Amount of component product back-ordered within parent product.
              • quantityOrdered (['integer', 'null'], format: int32)Amount of component product ordered within parent product.
              • size (['string', 'null'])Size of component product.
          • pageCount (['integer', 'null'], format: int32)

          • productDescription (['string', 'null'])
          • productLineNumber (['string', 'null'])Line number reference to the parent offer line item.
          • productNumber (['string', 'null'])
          • productOwner (['string', 'null'])
          • quantityOrdered (['integer', 'null'], format: int32)
          • size (['string', 'null'])
      • quantityOrdered (integer, format: int32, required)Amount of offer ordered for individual line item.

      • rushOrder (['boolean', 'null'])True/false indicator if individual line item is expedited.
      • shipToKey (['string', 'null'])Unique ID for Order.ShipTos.Key property associated to individual line item (NOTE: If top-level DefaultShipToKey is not set, this must be.).
      • taxAmount (['number', 'null'], format: double, required)Total tax amount applied to individual line item.
  • orderFee (['number', 'null'], format: double)Fee applied to Order. Minimum: 0.

  • orderVariablesManually entered variables for order within order management system (system where order lifecycle will be managed in).

    • One of

      • null
      • object
  • orderedBysOrder level ordered by contact and address details. Not required, but if present, each item must have required address fields and a non-null key.

    • One of

      • null
      • arrayLength must be at least 1.

        • Items (object)Bill to address object for Order. Cannot contain additional properties.

          • address1 (string, required)Address line 1 for address.
          • address2 (['string', 'null'])Address line 2 for address.
          • address3 (['string', 'null'])Address line 3 for address.
          • addressCode (['string', 'null'])Address code for address.
          • city (string, required)City name for address.
          • company (['string', 'null'])Company name for address.
          • country (string, required)Country name for address.
          • emailAddress (['string', 'null'])Contact email address for address.
          • faxNumber (['string', 'null'])Fax number for address.
          • key (string)Unique ID for individual contact.
          • name (string, required)
          • phoneNumber (['string', 'null'])Phone number for address.
          • postalCode (string, required)Postal code for address.
          • stateProvince (string, required)State or province name for address.
  • paymentMethods (['array', 'null'])Order.ShipTos level payment method details.

    • Items (object)Cannot contain additional properties.

      • amount (number, format: double, required)Total Amount. Required if MethodName specified.
      • methodName (string, required)Name of payment method. Required if Payment Amount specified.
  • pickPackHandlingFee (['number', 'null'], format: double)Sum of pick & pack handling fees for all Order.ShipTos. Minimum: 0.

  • poNumber (['string', 'null'])Purchase order number for Order. Maximum length 20 characters.
  • rushOrder (['boolean', 'null'])True/false indicator if Order is expedited.
  • shipTos (['array', 'null'])Order level ship to details. Required, must not be empty. Each item must have required address fields and a non-null key. Length must be at least 1.

    • Items (object)Cannot contain additional properties.

      • affiliateId (['string', 'null'])
      • referenceId (['string', 'null'])
      • sourceSystemShippingMethodId (['string', 'null'])
      • affiliateName (['string', 'null'])
      • comment (['string', 'null'])
      • costCenter (['string', 'null'])
      • creditCardFee (['number', 'null'], format: double)
      • dueDate (['string', 'null'])
      • key (string, required)Unique ID for individual ship to address.
      • orderFee (['number', 'null'], format: double)
      • paymentMethods (['array', 'null'])

        • Items (object)Cannot contain additional properties.

          • amount (number, format: double, required)Total Amount. Required if MethodName specified.
          • methodName (string, required)Name of payment method. Required if Payment Amount specified.
      • pickPackHandlingFee (['number', 'null'], format: double)

      • poNumber (['string', 'null'])
      • rushOrder (['boolean', 'null'])
      • shipToAddress (object)Ship to addresses array for Order. Cannot contain additional properties.

        • address1 (string, required)Address line 1 for address.
        • address2 (['string', 'null'])Address line 2 for address.
        • address3 (['string', 'null'])Address line 3 for address.
        • addressCode (['string', 'null'])Address code for address.
        • city (string, required)City name for address.
        • company (['string', 'null'])Company name for address.
        • country (string, required)Country name for address.
        • emailAddress (['string', 'null'])Contact email address for address.
        • faxNumber (['string', 'null'])Fax number for address.
        • name (string, required)
        • phoneNumber (['string', 'null'])Phone number for address.
        • postalCode (string, required)Postal code for address.
        • stateProvince (string, required)State or province name for address.
      • shippingCost (['number', 'null'], format: double)

      • shippingHandlingTax (['number', 'null'], format: double)
      • totalOrderFee (['number', 'null'], format: double)
  • shippingHandlingTax (number, format: double)Sum of shipping & handling taxes for all Order.ShipTos. Required, must not be null. Minimum: 0.

  • totalOrderFee (['number', 'null'], format: double)Sum of OrderFee. Minimum: 0.
  • totalShippingCost (['number', 'null'], format: double)Sum of shipping cost for all Order.ShipTos.Shipments. Minimum: 0.
  • lineItems (['array', 'null'])

    • Items (object)

      • offerLineNumber (string, required)

Examples

{
    "orderId": "7-mkkutsde-3-K-5649-4005-64",
    "referenceId": "OWMR WSKFA - LNSSZT XBUUJ & MS XXQ QCHX",
    "accessGroups": [
        "TS-Retail",
        "CDM Tuff Shed",
        "Tuff shed Act on behalf and see all orders"
    ],
    "affiliateIdentifier": "QJ-987",
    "affiliateName": "UJ-143-ABWJINHFVL, QD",
    "billTos": [
        {
            "address1": "16013 Valenzuela Turnpike",
            "address2": null,
            "address3": null,
            "city": "Rosaleshaven",
            "company": "Rosales-Shea",
            "country": "USA",
            "emailAddress": "chelseamiller@example.org",
            "faxNumber": "",
            "key": "0",
            "name": "Gail Stewart",
            "phoneNumber": "411-770-8380",
            "postalCode": "12507",
            "stateProvince": "Washington"
        }
    ],
    "costCenter": "020 - Denver",
    "createDateTime": "2025-02-28T20:37:42.018+00:00",
    "creditCardFee": 0.0,
    "dueDate": null,
    "lineItems": [
        {
            "offerId": "t87grb75-e9pe-5405-y8yv-25n5q70bu93i",
            "referenceId": "BEHZ QUJNS - TPGJXT MMGVN & UX ZDN HHQS",
            "variableTemplatePrintId": null,
            "additionalProperties": [],
            "billToKey": "0",
            "comment": null,
            "costCenter": "020 - Denver",
            "dueDate": null,
            "lineItemFee": 0.75,
            "offerDescription": "<p>$17.00 Each \u2013 S - XL<br>\n$20.00 Each \u2013 2XL - XLarge/Tall Sizes<br>\n$21.50 Each \u2013 3XL - 2XLarge/Tall sizes<br>$25.00 Each - 4XL Sizes - 3XL tall <br>$35.00 Each - 5XL Sizes<br><br></p>",
            "offerLineNumber": "0",
            "offerNumber": "TS_A-A0050",
            "orderedByKey": "0",
            "poNumber": null,
            "price": 17.0,
            "products": [
                {
                    "productId": "3j8hu98q-s0t6-409v-029r-321r0uo02k30",
                    "associatedFileName": "",
                    "color": null,
                    "comment": null,
                    "components": [],
                    "productDescription": "8\"x8\" square paint swatch.",
                    "productLineNumber": "1",
                    "productNumber": "R_962_24008_TSO",
                    "productOwner": null,
                    "quantityOrdered": null,
                    "size": null
                },
                {
                    "productId": "7jv34sz5-m4q8-8q8f-187d-jt7791j02958",
                    "associatedFileName": "",
                    "color": null,
                    "comment": null,
                    "components": [],
                    "productDescription": "Tuff Shed Men's Polo",
                    "productLineNumber": "2",
                    "productNumber": "TS_A-A0050",
                    "productOwner": null,
                    "quantityOrdered": null,
                    "size": null
                }
            ],
            "quantityOrdered": 1,
            "rushOrder": false,
            "shipToKey": "0",
            "taxAmount": 0.0
        }
    ],
    "orderFee": 4.0,
    "orderVariables": {},
    "orderedBys": [
        {
            "address1": "42801 Pamela Run",
            "address2": null,
            "address3": null,
            "city": "Port Rickside",
            "company": "Trujillo-Sims",
            "country": "USA",
            "emailAddress": "jonesjeff@example.net",
            "faxNumber": "",
            "key": "0",
            "name": "Benjamin Smith",
            "phoneNumber": "+1-310-761-3615x7115",
            "postalCode": "10330",
            "stateProvince": "California"
        }
    ],
    "paymentMethods": [
        {
            "amount": 35.8,
            "methodName": "invoice"
        }
    ],
    "pickPackHandlingFee": 0.75,
    "poNumber": null,
    "rushOrder": false,
    "shipTos": [
        {
            "affiliateId": "EK-023",
            "referenceId": "QGSN VNSAH - PWJRVG OCYIA & PG GAE RZTN",
            "sourceSystemShippingMethodId": "qnigy_cxdcmo",
            "affiliateName": "JK-467-WLTQIEOCCZ, PA",
            "comment": null,
            "costCenter": "020 - Denver",
            "creditCardFee": 0.0,
            "dueDate": null,
            "key": "0",
            "orderFee": 4.0,
            "paymentMethods": [],
            "pickPackHandlingFee": 0.75,
            "poNumber": null,
            "rushOrder": false,
            "shipToAddress": {
                "address1": "130 Owen Gateway",
                "address2": null,
                "address3": null,
                "city": "Arthurborough",
                "company": "Bryant-Compton",
                "country": "USA",
                "emailAddress": "yduran@example.com",
                "faxNumber": "",
                "name": "Patricia Parker",
                "phoneNumber": "317.410.1217",
                "postalCode": "96718",
                "stateProvince": "Georgia"
            },
            "shippingCost": 13.66,
            "shippingHandlingTax": 0.39,
            "totalOrderFee": 4.0
        }
    ],
    "shippingHandlingTax": 0.39,
    "totalOrderFee": 4.0,
    "totalShippingCost": 13.66
}

Quicktype Command

quicktype \
    --framework SystemTextJson  \
    --lang cs  \
    --number-type double  \
    --src-lang schema  \
    --no-check-required  \
    --density dense  \
    --features complete  \
    --namespace OtpSchema.Api.OrderBroker.NewOrderRequest  \
    --src .working/build/internal/json-schema-for-cs/NewOrderRequest.json -o .working/build/internal/csharp/OtpSchema/Api/OrderBroker/NewOrderRequest.cs
NewOrderRequest
// <auto-generated />
//
// To parse this JSON data, add NuGet 'System.Text.Json' then do:
//
//    using OtpSchema.Api.OrderBroker.NewOrderRequest;
//
//    var newOrderRequest = NewOrderRequest.FromJson(jsonString);
#nullable enable
#pragma warning disable CS8618
#pragma warning disable CS8601
#pragma warning disable CS8603

namespace OtpSchema.Api.OrderBroker.NewOrderRequest
{
    using System;
    using System.Collections.Generic;

    using System.Text.Json;
    using System.Text.Json.Serialization;
    using System.Globalization;
    using J = System.Text.Json.Serialization.JsonPropertyNameAttribute;
    using N = System.Text.Json.Serialization.JsonIgnoreCondition;

    /// <summary>Details for Order JSON schema. Conditional constraints (enforced in backend): If; defaultBillToKey, defaultOrderedByKey, or defaultShipToKey are null, corresponding keys; must be set on each line item. If defaultBillToKey, defaultOrderedByKey, or; defaultShipToKey are not null, they must match a key in billTos, orderedBys, or shipTos; respectively. OfferLineNumber, productLineNumber, and componentLineNumber values must be; unique within their collections if provided.</summary>
    public partial class NewOrderRequest
    {
        [J("accessGroups")]                                                                                                                       public string[] AccessGroups { get; set; }                        
        [J("affiliateIdentifier")][JsonConverter(typeof(PurpleMinMaxLengthCheckConverter))]                                                       public string AffiliateIdentifier { get; set; }                    // Unique ID for affiliate within source system (system where order was originally placed)
        [J("affiliateName")][JsonConverter(typeof(FluffyMinMaxLengthCheckConverter))]                                                             public string AffiliateName { get; set; }                          // Name for affiliate within source system (system where order was originally placed)
        [J("billTos")]                                                                                                                            public BillTo[] BillTos { get; set; }                              // Bill to addresses array for Order. Required, must not be empty. Each item must have; required address fields and a non-null key.
        [J("costCenter")][JsonConverter(typeof(FluffyMinMaxLengthCheckConverter))]                                                                public string CostCenter { get; set; }                            
        [J("createDateTime")]                                                                                                                     public string CreateDateTime { get; set; }                         // Datetime of when order was created
        [J("creditCardFee")][JsonConverter(typeof(MinMaxValueCheckConverter))]                                                                    public double? CreditCardFee { get; set; }                         // Credit card transaction fee applied to Order
        [J("defaultBillToKey")]                                                                                                                   public string DefaultBillToKey { get; set; }                       // Unique ID for default billing contact details pulled from Order.BillTos.Key property; (Only if applicable. Otherwise DefaultBillToKey will be null/empty value) (NOTE: If this; value is not set, BillToKey must be set on all line items.)
        [J("defaultOrderedByKey")]                                                                                                                public string DefaultOrderedByKey { get; set; }                    // Unique ID for default ordered by contact details pulled from Order.OrderedBy.Key property; (Only if applicable. Otherwise DefaultOrderedByKey will be null/empty value)
        [J("defaultShipToKey")]                                                                                                                   public string DefaultShipToKey { get; set; }                       // Unique ID for default ship to contact pulled from Order.ShipTos.Key property (Only if; applicable. Otherwise DefaultShipToKey will be null/empty value) (NOTE: If this value is; not set, ShipToKey must be set on all line items.)
        [J("dueDate")]                                                                                                                            public string DueDate { get; set; }                                // Datetime of expected due date for Order. If present, must be a valid date and not in the; past (enforced in backend).
        [J("lineItems")]                                                                                                                          public LineItem[] LineItems { get; set; }                          // Order level line item details. Required, must not be empty. Each item must have offerId,; quantityOrdered > 0, price >= 0, taxAmount >= 0, lineItemFee >= 0. If defaultBillToKey,; defaultOrderedByKey, or defaultShipToKey are null, corresponding keys must be set on each; line item.
        [J("orderedBys")]                                                                                                                         public OrderedBy[] OrderedBys { get; set; }                        // Order level ordered by contact and address details. Not required, but if present, each; item must have required address fields and a non-null key.
        [J("orderFee")][JsonConverter(typeof(MinMaxValueCheckConverter))]                                                                         public double? OrderFee { get; set; }                              // Fee applied to Order
        [J("orderId")][JsonConverter(typeof(StickyMinMaxLengthCheckConverter))]                                                                   public string OrderId { get; set; }                                // Unique ID for order within order management system (system where order lifecycle will be; managed). Required, must not be null or empty.
        [J("orderVariables")]                                                                                                                     public Dictionary<string, object> OrderVariables { get; set; }     // Manually entered variables for order within order management system (system where order; lifecycle will be managed in)
        [J("paymentMethods")]                                                                                                                     public NewOrderRequestPaymentMethod[] PaymentMethods { get; set; } // Order.ShipTos level payment method details
        [J("pickPackHandlingFee")][JsonConverter(typeof(MinMaxValueCheckConverter))]                                                              public double? PickPackHandlingFee { get; set; }                   // Sum of pick & pack handling fees for all Order.ShipTos
        [J("poNumber")][JsonConverter(typeof(IndigoMinMaxLengthCheckConverter))]                                                                  public string PoNumber { get; set; }                               // Purchase order number for Order. Maximum length 20 characters.
        [J("referenceId")][JsonConverter(typeof(FluffyMinMaxLengthCheckConverter))]                                                               public string ReferenceId { get; set; }                           
        [J("rushOrder")]                                                                                                                          public bool? RushOrder { get; set; }                               // True/false indicator if Order is expedited
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)][J("shippingHandlingTax")][JsonConverter(typeof(MinMaxValueCheckConverter))] public double? ShippingHandlingTax { get; set; }                   // Sum of shipping & handling taxes for all Order.ShipTos. Required, must not be null.
        [J("shipTos")]                                                                                                                            public ShipTo[] ShipTos { get; set; }                              // Order level ship to details. Required, must not be empty. Each item must have required; address fields and a non-null key.
        [J("totalOrderFee")][JsonConverter(typeof(MinMaxValueCheckConverter))]                                                                    public double? TotalOrderFee { get; set; }                         // Sum of OrderFee
        [J("totalShippingCost")][JsonConverter(typeof(MinMaxValueCheckConverter))]                                                                public double? TotalShippingCost { get; set; }                     // Sum of shipping cost for all Order.ShipTos.Shipments
    }

    public partial class BillTo
    {
        [J("address1")]      public string Address1 { get; set; }      // Address line 1 for address
        [J("address2")]      public string Address2 { get; set; }      // Address line 2 for address
        [J("address3")]      public string Address3 { get; set; }      // Address line 3 for address
        [J("addressCode")]   public string AddressCode { get; set; }   // Address code for address
        [J("city")]          public string City { get; set; }          // City name for address
        [J("company")]       public string Company { get; set; }       // Company name for address
        [J("country")]       public string Country { get; set; }       // Country name for address
        [J("emailAddress")]  public string EmailAddress { get; set; }  // Contact email address for address
        [J("faxNumber")]     public string FaxNumber { get; set; }     // Fax number for address
        [J("key")]           public string Key { get; set; }           // Unique ID for individual contact
        [J("name")]          public string Name { get; set; }          // Contact name for this address
        [J("phoneNumber")]   public string PhoneNumber { get; set; }   // Phone number for address
        [J("postalCode")]    public string PostalCode { get; set; }    // Postal code for address
        [J("stateProvince")] public string StateProvince { get; set; } // State or province name for address
    }

    /// <summary>Order level line item details</summary>
    public partial class LineItem
    {
        [J("additionalProperties")]                                                                                                                 public AdditionalProperty[] AdditionalProperties { get; set; } // Additional properties details for Order LineItems
        [J("billToKey")]                                                                                                                            public string BillToKey { get; set; }                          // Unique ID for Order.BillTos.Key property associated to individual line item (NOTE: If; top-level DefaultBillToKey is not set, this must be.)
        [J("comment")]                                                                                                                              public string Comment { get; set; }                            // Manually entered comment for individual line item
        [J("costCenter")]                                                                                                                           public string CostCenter { get; set; }                        
        [J("dueDate")]                                                                                                                              public string DueDate { get; set; }                            // Datetime of expected due date for individual line item
        [J("lineItemFee")]                                                                                                                          public double LineItemFee { get; set; }                        // Fee applied to individual line item
        [J("offerDescription")]                                                                                                                     public string OfferDescription { get; set; }                   // Description for offer within product management system (system where ordered line item; products will be managed)
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)][J("offerId")][JsonConverter(typeof(TentacledMinMaxLengthCheckConverter))]     public string OfferId { get; set; }                            // Unique ID for offer within Integration Broker
        [J("offerLineNumber")]                                                                                                                      public string OfferLineNumber { get; set; }                    // Unique ID for individual line item
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)][J("offerNumber")][JsonConverter(typeof(TentacledMinMaxLengthCheckConverter))] public string OfferNumber { get; set; }                        // Name for offer within product management system (system where ordered line item products; will be managed)
        [J("orderedByKey")]                                                                                                                         public string OrderedByKey { get; set; }                       // Unique ID for Order.OrderedBy.Key property associated to individual line item
        [J("poNumber")]                                                                                                                             public string PoNumber { get; set; }                           // Purchase order number for individual line item
        [J("price")]                                                                                                                                public double Price { get; set; }                              // Total offer price of individual line item
        [J("products")]                                                                                                                             public Product[] Products { get; set; }                       
        [J("quantityOrdered")]                                                                                                                      public long QuantityOrdered { get; set; }                      // Amount of offer ordered for individual line item
        [J("referenceId")]                                                                                                                          public string ReferenceId { get; set; }                       
        [J("rushOrder")]                                                                                                                            public bool? RushOrder { get; set; }                           // True/false indicator if individual line item is expedited
        [J("shipToKey")]                                                                                                                            public string ShipToKey { get; set; }                          // Unique ID for Order.ShipTos.Key property associated to individual line item (NOTE: If; top-level DefaultShipToKey is not set, this must be.)
        [J("taxAmount")]                                                                                                                            public double? TaxAmount { get; set; }                         // Total tax amount applied to individual line item
        [J("variableTemplatePrintId")]                                                                                                              public string VariableTemplatePrintId { get; set; }            // Unique ID for variable template file associated to offer on individual line item
    }

    /// <summary>Order.LineItems level additional properties details</summary>
    public partial class AdditionalProperty
    {
        [J("key")]   public string Key { get; set; }  
        [J("value")] public string Value { get; set; }
    }

    public partial class Product
    {
        [J("associatedFileName")] public string AssociatedFileName { get; set; }
        [J("color")]              public string Color { get; set; }             
        [J("comment")]            public string Comment { get; set; }           
        [J("components")]         public Component[] Components { get; set; }   
        [J("pageCount")]          public long? PageCount { get; set; }          
        [J("productDescription")] public string ProductDescription { get; set; }
        [J("productId")]          public string ProductId { get; set; }         
        [J("productLineNumber")]  public string ProductLineNumber { get; set; }  // Line number reference to the parent offer line item
        [J("productNumber")]      public string ProductNumber { get; set; }     
        [J("productOwner")]       public string ProductOwner { get; set; }      
        [J("quantityOrdered")]    public long? QuantityOrdered { get; set; }    
        [J("size")]               public string Size { get; set; }              
    }

    /// <summary>Product component details</summary>
    public partial class Component
    {
        [J("associatedFileName")]  public string AssociatedFileName { get; set; }  // Name of file associated to component product (if applicable)
        [J("color")]               public string Color { get; set; }               // Color of component product
        [J("comment")]             public string Comment { get; set; }             // Manually entered comment for component product
        [J("componentLineNumber")] public string ComponentLineNumber { get; set; } // Unique ID for component product within parent product
        [J("productDescription")]  public string ProductDescription { get; set; }  // Description for component product within product management system (system where ordered; line item products will be managed)
        [J("productId")]           public string ProductId { get; set; }           // Unique ID for component product within Integration Broker
        [J("productNumber")]       public string ProductNumber { get; set; }       // Name for component product within product management system (system where ordered line; item products will be managed)
        [J("productOwner")]        public string ProductOwner { get; set; }        // Owner of component product
        [J("quantityBackordered")] public long? QuantityBackordered { get; set; }  // Amount of component product back-ordered within parent product
        [J("quantityOrdered")]     public long? QuantityOrdered { get; set; }      // Amount of component product ordered within parent product
        [J("size")]                public string Size { get; set; }                // Size of component product
    }

    /// <summary>Bill to address object for Order</summary>
    public partial class OrderedBy
    {
        [J("address1")]                                                         public string Address1 { get; set; }      // Address line 1 for address
        [J("address2")]                                                         public string Address2 { get; set; }      // Address line 2 for address
        [J("address3")]                                                         public string Address3 { get; set; }      // Address line 3 for address
        [J("addressCode")]                                                      public string AddressCode { get; set; }   // Address code for address
        [J("city")]                                                             public string City { get; set; }          // City name for address
        [J("company")]                                                          public string Company { get; set; }       // Company name for address
        [J("country")]                                                          public string Country { get; set; }       // Country name for address
        [J("emailAddress")]                                                     public string EmailAddress { get; set; }  // Contact email address for address
        [J("faxNumber")]                                                        public string FaxNumber { get; set; }     // Fax number for address
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)][J("key")] public string Key { get; set; }           // Unique ID for individual contact
        [J("name")]                                                             public string Name { get; set; }         
        [J("phoneNumber")]                                                      public string PhoneNumber { get; set; }   // Phone number for address
        [J("postalCode")]                                                       public string PostalCode { get; set; }    // Postal code for address
        [J("stateProvince")]                                                    public string StateProvince { get; set; } // State or province name for address
    }

    public partial class NewOrderRequestPaymentMethod
    {
        [J("amount")]     public double Amount { get; set; }     // Total Amount.  Required if MethodName specified
        [J("methodName")] public string MethodName { get; set; } // Name of payment method.  Required if Payment Amount specified
    }

    public partial class ShipTo
    {
        [J("affiliateId")]                                                                public string AffiliateId { get; set; }                  
        [J("affiliateName")]                                                              public string AffiliateName { get; set; }                
        [J("comment")]                                                                    public string Comment { get; set; }                      
        [J("costCenter")]                                                                 public string CostCenter { get; set; }                   
        [J("creditCardFee")]                                                              public double? CreditCardFee { get; set; }               
        [J("dueDate")]                                                                    public string DueDate { get; set; }                      
        [J("key")]                                                                        public string Key { get; set; }                           // Unique ID for individual ship to address
        [J("orderFee")]                                                                   public double? OrderFee { get; set; }                    
        [J("paymentMethods")]                                                             public ShipToPaymentMethod[] PaymentMethods { get; set; }
        [J("pickPackHandlingFee")]                                                        public double? PickPackHandlingFee { get; set; }         
        [J("poNumber")]                                                                   public string PoNumber { get; set; }                     
        [J("referenceId")]                                                                public string ReferenceId { get; set; }                  
        [J("rushOrder")]                                                                  public bool? RushOrder { get; set; }                     
        [J("shippingCost")]                                                               public double? ShippingCost { get; set; }                
        [J("shippingHandlingTax")]                                                        public double? ShippingHandlingTax { get; set; }         
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)][J("shipToAddress")] public ShipToAddress ShipToAddress { get; set; }          // Ship to addresses array for Order
        [J("sourceSystemShippingMethodId")]                                               public string SourceSystemShippingMethodId { get; set; } 
        [J("totalOrderFee")]                                                              public double? TotalOrderFee { get; set; }               
    }

    public partial class ShipToPaymentMethod
    {
        [J("amount")]     public double Amount { get; set; }     // Total Amount.  Required if MethodName specified
        [J("methodName")] public string MethodName { get; set; } // Name of payment method.  Required if Payment Amount specified
    }

    /// <summary>Ship to addresses array for Order</summary>
    public partial class ShipToAddress
    {
        [J("address1")]      public string Address1 { get; set; }      // Address line 1 for address
        [J("address2")]      public string Address2 { get; set; }      // Address line 2 for address
        [J("address3")]      public string Address3 { get; set; }      // Address line 3 for address
        [J("addressCode")]   public string AddressCode { get; set; }   // Address code for address
        [J("city")]          public string City { get; set; }          // City name for address
        [J("company")]       public string Company { get; set; }       // Company name for address
        [J("country")]       public string Country { get; set; }       // Country name for address
        [J("emailAddress")]  public string EmailAddress { get; set; }  // Contact email address for address
        [J("faxNumber")]     public string FaxNumber { get; set; }     // Fax number for address
        [J("name")]          public string Name { get; set; }         
        [J("phoneNumber")]   public string PhoneNumber { get; set; }   // Phone number for address
        [J("postalCode")]    public string PostalCode { get; set; }    // Postal code for address
        [J("stateProvince")] public string StateProvince { get; set; } // State or province name for address
    }

    public partial class NewOrderRequest
    {
        public static NewOrderRequest FromJson(string json) => JsonSerializer.Deserialize<NewOrderRequest>(json, OtpSchema.Api.OrderBroker.NewOrderRequest.Converter.Settings);
    }

    public static class Serialize
    {
        public static string ToJson(this NewOrderRequest self) => JsonSerializer.Serialize(self, OtpSchema.Api.OrderBroker.NewOrderRequest.Converter.Settings);
    }

    internal static class Converter
    {
        public static readonly JsonSerializerOptions Settings = new(JsonSerializerDefaults.General)
        {
            Converters =
            {
                new DateOnlyConverter(),
                new TimeOnlyConverter(),
                IsoDateTimeOffsetConverter.Singleton
            },
        };
    }

    internal class PurpleMinMaxLengthCheckConverter : JsonConverter<string>
    {
        public override bool CanConvert(Type t) => t == typeof(string);

        public override string Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
        {
            var value = reader.GetString();
            if (value != null && value.Length <= 100)
            {
                return value;
            }
            throw new Exception("Cannot unmarshal type string");
        }

        public override void Write(Utf8JsonWriter writer, string value, JsonSerializerOptions options)
        {
            if (value != null && value.Length <= 100)
            {
                JsonSerializer.Serialize(writer, value, options);
                return;
            }
            throw new Exception("Cannot marshal type string");
        }

        public static readonly PurpleMinMaxLengthCheckConverter Singleton = new PurpleMinMaxLengthCheckConverter();
    }

    internal class FluffyMinMaxLengthCheckConverter : JsonConverter<string>
    {
        public override bool CanConvert(Type t) => t == typeof(string);

        public override string Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
        {
            var value = reader.GetString();
            if (value != null && value.Length <= 255)
            {
                return value;
            }
            throw new Exception("Cannot unmarshal type string");
        }

        public override void Write(Utf8JsonWriter writer, string value, JsonSerializerOptions options)
        {
            if (value != null && value.Length <= 255)
            {
                JsonSerializer.Serialize(writer, value, options);
                return;
            }
            throw new Exception("Cannot marshal type string");
        }

        public static readonly FluffyMinMaxLengthCheckConverter Singleton = new FluffyMinMaxLengthCheckConverter();
    }

    internal class MinMaxValueCheckConverter : JsonConverter<double>
    {
        public override bool CanConvert(Type t) => t == typeof(double);

        public override double Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
        {
            var value = reader.GetDouble();
            if (value >= 0)
            {
                return value;
            }
            throw new Exception("Cannot unmarshal type double");
        }

        public override void Write(Utf8JsonWriter writer, double value, JsonSerializerOptions options)
        {
            if (value >= 0)
            {
                JsonSerializer.Serialize(writer, value, options);
                return;
            }
            throw new Exception("Cannot marshal type double");
        }

        public static readonly MinMaxValueCheckConverter Singleton = new MinMaxValueCheckConverter();
    }

    internal class TentacledMinMaxLengthCheckConverter : JsonConverter<string>
    {
        public override bool CanConvert(Type t) => t == typeof(string);

        public override string Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
        {
            var value = reader.GetString();
            if (value != null && value.Length >= 1)
            {
                return value;
            }
            throw new Exception("Cannot unmarshal type string");
        }

        public override void Write(Utf8JsonWriter writer, string value, JsonSerializerOptions options)
        {
            if (value != null && value.Length >= 1)
            {
                JsonSerializer.Serialize(writer, value, options);
                return;
            }
            throw new Exception("Cannot marshal type string");
        }

        public static readonly TentacledMinMaxLengthCheckConverter Singleton = new TentacledMinMaxLengthCheckConverter();
    }

    internal class StickyMinMaxLengthCheckConverter : JsonConverter<string>
    {
        public override bool CanConvert(Type t) => t == typeof(string);

        public override string Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
        {
            var value = reader.GetString();
            if (value != null && value.Length >= 1 && value.Length <= 100)
            {
                return value;
            }
            throw new Exception("Cannot unmarshal type string");
        }

        public override void Write(Utf8JsonWriter writer, string value, JsonSerializerOptions options)
        {
            if (value != null && value.Length >= 1 && value.Length <= 100)
            {
                JsonSerializer.Serialize(writer, value, options);
                return;
            }
            throw new Exception("Cannot marshal type string");
        }

        public static readonly StickyMinMaxLengthCheckConverter Singleton = new StickyMinMaxLengthCheckConverter();
    }

    internal class IndigoMinMaxLengthCheckConverter : JsonConverter<string>
    {
        public override bool CanConvert(Type t) => t == typeof(string);

        public override string Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
        {
            var value = reader.GetString();
            if (value != null && value.Length <= 20)
            {
                return value;
            }
            throw new Exception("Cannot unmarshal type string");
        }

        public override void Write(Utf8JsonWriter writer, string value, JsonSerializerOptions options)
        {
            if (value != null && value.Length <= 20)
            {
                JsonSerializer.Serialize(writer, value, options);
                return;
            }
            throw new Exception("Cannot marshal type string");
        }

        public static readonly IndigoMinMaxLengthCheckConverter Singleton = new IndigoMinMaxLengthCheckConverter();
    }

    public class DateOnlyConverter : JsonConverter<DateOnly>
    {
        private readonly string serializationFormat;
        public DateOnlyConverter() : this(null) { }

        public DateOnlyConverter(string? serializationFormat)
        {
                this.serializationFormat = serializationFormat ?? "yyyy-MM-dd";
        }

        public override DateOnly Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
        {
                var value = reader.GetString();
                return DateOnly.Parse(value!);
        }

        public override void Write(Utf8JsonWriter writer, DateOnly value, JsonSerializerOptions options)
                => writer.WriteStringValue(value.ToString(serializationFormat));
    }

    public class TimeOnlyConverter : JsonConverter<TimeOnly>
    {
        private readonly string serializationFormat;

        public TimeOnlyConverter() : this(null) { }

        public TimeOnlyConverter(string? serializationFormat)
        {
                this.serializationFormat = serializationFormat ?? "HH:mm:ss.fff";
        }

        public override TimeOnly Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
        {
                var value = reader.GetString();
                return TimeOnly.Parse(value!);
        }

        public override void Write(Utf8JsonWriter writer, TimeOnly value, JsonSerializerOptions options)
                => writer.WriteStringValue(value.ToString(serializationFormat));
    }

    internal class IsoDateTimeOffsetConverter : JsonConverter<DateTimeOffset>
    {
        public override bool CanConvert(Type t) => t == typeof(DateTimeOffset);

        private const string DefaultDateTimeFormat = "yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK";

        private DateTimeStyles _dateTimeStyles = DateTimeStyles.RoundtripKind;
        private string? _dateTimeFormat;
        private CultureInfo? _culture;

        public DateTimeStyles DateTimeStyles
        {
                get => _dateTimeStyles;
                set => _dateTimeStyles = value;
        }

        public string? DateTimeFormat
        {
                get => _dateTimeFormat ?? string.Empty;
                set => _dateTimeFormat = (string.IsNullOrEmpty(value)) ? null : value;
        }

        public CultureInfo Culture
        {
                get => _culture ?? CultureInfo.CurrentCulture;
                set => _culture = value;
        }

        public override void Write(Utf8JsonWriter writer, DateTimeOffset value, JsonSerializerOptions options)
        {
                string text;


                if ((_dateTimeStyles & DateTimeStyles.AdjustToUniversal) == DateTimeStyles.AdjustToUniversal
                        || (_dateTimeStyles & DateTimeStyles.AssumeUniversal) == DateTimeStyles.AssumeUniversal)
                {
                        value = value.ToUniversalTime();
                }

                text = value.ToString(_dateTimeFormat ?? DefaultDateTimeFormat, Culture);

                writer.WriteStringValue(text);
        }

        public override DateTimeOffset Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
        {
                string? dateText = reader.GetString();

                if (string.IsNullOrEmpty(dateText) == false)
                {
                        if (!string.IsNullOrEmpty(_dateTimeFormat))
                        {
                                return DateTimeOffset.ParseExact(dateText, _dateTimeFormat, Culture, _dateTimeStyles);
                        }
                        else
                        {
                                return DateTimeOffset.Parse(dateText, Culture, _dateTimeStyles);
                        }
                }
                else
                {
                        return default(DateTimeOffset);
                }
        }


        public static readonly IsoDateTimeOffsetConverter Singleton = new IsoDateTimeOffsetConverter();
    }
}
#pragma warning restore CS8618
#pragma warning restore CS8601
#pragma warning restore CS8603

NewOrderRequest
{
  "$schema": "http://json-schema.org/draft-07/schema#", 
  "$id": "NewOrderRequest.json", 
  "description": "Details for Order JSON schema. Conditional constraints (enforced in backend): If defaultBillToKey, defaultOrderedByKey, or defaultShipToKey are null, corresponding keys must be set on each line item. If defaultBillToKey, defaultOrderedByKey, or defaultShipToKey are not null, they must match a key in billTos, orderedBys, or shipTos respectively. OfferLineNumber, productLineNumber, and componentLineNumber values must be unique within their collections if provided.", 
  "type": "object", 
  "additionalProperties": false, 
  "properties": {
    "orderId": {
      "description": "Unique ID for order within order management system (system where order lifecycle will be managed). Required, must not be null or empty.", 
      "type": "string", 
      "maxLength": 100, 
      "minLength": 1
    }, 
    "referenceId": { "type": ["string", "null"], "maxLength": 255 }, 
    "accessGroups": { "type": ["array", "null"], "items": {"type": "string"} }, 
    "affiliateIdentifier": {
      "description": "Unique ID for affiliate within source system (system where order was originally placed)", 
      "type": ["string", "null"], 
      "maxLength": 100
    }, 
    "affiliateName": {
      "description": "Name for affiliate within source system (system where order was originally placed)", 
      "type": ["string", "null"], 
      "maxLength": 255
    }, 
    "billTos": {
      "description": "Bill to addresses array for Order. Required, must not be empty. Each item must have required address fields and a non-null key.", 
      "oneOf": [
        {"type": "null"}, 
        {
          "type": "array", 
          "items": {
            "type": "object", 
            "additionalProperties": false, 
            "properties": {
              "address1": {"description": "Address line 1 for address", "type": "string"}, 
              "address2": { "description": "Address line 2 for address", "type": ["string", "null"] }, 
              "address3": { "description": "Address line 3 for address", "type": ["string", "null"] }, 
              "addressCode": { "description": "Address code for address", "type": ["string", "null"] }, 
              "city": {"description": "City name for address", "type": "string"}, 
              "company": { "description": "Company name for address", "type": ["string", "null"] }, 
              "country": {"description": "Country name for address", "type": "string"}, 
              "emailAddress": {
                "description": "Contact email address for address", 
                "type": ["string", "null"]
              }, 
              "faxNumber": { "description": "Fax number for address", "type": ["string", "null"] }, 
              "key": {
                "description": "Unique ID for individual contact", 
                "type": "string", 
                "pattern": "^[0-9]+$"
              }, 
              "name": {"description": "Contact name for this address", "type": "string"}, 
              "phoneNumber": { "description": "Phone number for address", "type": ["string", "null"] }, 
              "postalCode": {"description": "Postal code for address", "type": "string"}, 
              "stateProvince": {"description": "State or province name for address", "type": "string"}
            }, 
            "required": ["address1", "city", "country", "key", "name", "postalCode", "stateProvince"]
          }, 
          "minItems": 1
        }
      ]
    }, 
    "costCenter": { "type": ["string", "null"], "maxLength": 255 }, 
    "createDateTime": {
      "description": "Datetime of when order was created", 
      "type": ["string", "null"]
    }, 
    "creditCardFee": {
      "description": "Credit card transaction fee applied to Order", 
      "type": ["number", "null"], 
      "format": "double", 
      "minimum": 0
    }, 
    "defaultBillToKey": {
      "description": "Unique ID for default billing contact details pulled from Order.BillTos.Key property (Only if applicable. Otherwise DefaultBillToKey will be null/empty value) (NOTE: If this value is not set, BillToKey must be set on all line items.)", 
      "type": ["string", "null"], 
      "pattern": "^[0-9]+$"
    }, 
    "defaultOrderedByKey": {
      "description": "Unique ID for default ordered by contact details pulled from Order.OrderedBy.Key property (Only if applicable. Otherwise DefaultOrderedByKey will be null/empty value)", 
      "type": ["string", "null"], 
      "pattern": "^[0-9]+$"
    }, 
    "defaultShipToKey": {
      "description": "Unique ID for default ship to contact pulled from Order.ShipTos.Key property (Only if applicable. Otherwise DefaultShipToKey will be null/empty value) (NOTE: If this value is not set, ShipToKey must be set on all line items.)", 
      "type": ["string", "null"], 
      "pattern": "^[0-9]+$"
    }, 
    "dueDate": {
      "description": "Datetime of expected due date for Order. If present, must be a valid date and not in the past (enforced in backend).", 
      "type": ["string", "null"], 
      "pattern": "^(\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}|\\d{8}|\\d{2}[-/]\\d{2}[-/]\\d{4}(\\s\\d{2}:\\d{2}:\\d{2})?)$"
    }, 
    "lineItems": {
      "description": "Order level line item details. Required, must not be empty. Each item must have offerId, quantityOrdered > 0, price >= 0, taxAmount >= 0, lineItemFee >= 0. If defaultBillToKey, defaultOrderedByKey, or defaultShipToKey are null, corresponding keys must be set on each line item.", 
      "type": ["array"], 
      "items": {
        "description": "Order level line item details", 
        "type": "object", 
        "anyOf": [
          {
            "properties": { "offerId": {"type": "string", "minLength": 1} }, 
            "required": ["offerId"]
          }, 
          {
            "properties": { "offerNumber": {"type": "string", "minLength": 1} }, 
            "required": ["offerNumber"]
          }
        ], 
        "additionalProperties": false, 
        "properties": {
          "offerId": {
            "description": "Unique ID for offer within Integration Broker", 
            "type": "string"
          }, 
          "referenceId": { "type": ["string", "null"] }, 
          "variableTemplatePrintId": {
            "description": "Unique ID for variable template file associated to offer on individual line item", 
            "type": ["string", "null"]
          }, 
          "additionalProperties": {
            "description": "Additional properties details for Order LineItems", 
            "type": ["array", "null"], 
            "items": {
              "description": "Order.LineItems level additional properties details", 
              "type": "object", 
              "additionalProperties": false, 
              "properties": {
                "key"  : { "type": ["string", "null"] }, 
                "value": { "type": ["string", "null"] }
              }, 
              "required": ["key", "value"]
            }
          }, 
          "billToKey": {
            "description": "Unique ID for Order.BillTos.Key property associated to individual line item (NOTE: If top-level DefaultBillToKey is not set, this must be.)", 
            "type": ["string", "null"], 
            "pattern": "^[0-9]+$"
          }, 
          "comment": {
            "description": "Manually entered comment for individual line item", 
            "type": ["string", "null"]
          }, 
          "costCenter": { "type": ["string", "null"] }, 
          "dueDate": {
            "description": "Datetime of expected due date for individual line item", 
            "type": ["string", "null"]
          }, 
          "lineItemFee": {
            "description": "Fee applied to individual line item", 
            "type": "number", 
            "format": "double"
          }, 
          "offerDescription": {
            "description": "Description for offer within product management system (system where ordered line item products will be managed)", 
            "type": ["string", "null"]
          }, 
          "offerLineNumber": {
            "description": "Unique ID for individual line item", 
            "type": ["string", "null"]
          }, 
          "offerNumber": {
            "description": "Name for offer within product management system (system where ordered line item products will be managed)", 
            "type": ["string", "null"]
          }, 
          "orderedByKey": {
            "description": "Unique ID for Order.OrderedBy.Key property associated to individual line item", 
            "type": ["string", "null"], 
            "pattern": "^[0-9]+$"
          }, 
          "poNumber": {
            "description": "Purchase order number for individual line item", 
            "type": ["string", "null"]
          }, 
          "price": {
            "description": "Total offer price of individual line item", 
            "type": "number", 
            "format": "double"
          }, 
          "products": {
            "type": ["array", "null"], 
            "items": {
              "type": "object", 
              "additionalProperties": false, 
              "properties": {
                "productId": {"type": "string"}, 
                "associatedFileName": { "type": ["string", "null"] }, 
                "color": { "type": ["string", "null"] }, 
                "comment": { "type": ["string", "null"] }, 
                "components": {
                  "type": ["array", "null"], 
                  "items": {
                    "description": "Product component details", 
                    "type": "object", 
                    "additionalProperties": false, 
                    "properties": {
                      "productId": {
                        "description": "Unique ID for component product within Integration Broker", 
                        "type": "string"
                      }, 
                      "associatedFileName": {
                        "description": "Name of file associated to component product (if applicable)", 
                        "type": ["string", "null"]
                      }, 
                      "color": { "description": "Color of component product", "type": ["string", "null"] }, 
                      "comment": {
                        "description": "Manually entered comment for component product", 
                        "type": ["string", "null"]
                      }, 
                      "componentLineNumber": {
                        "description": "Unique ID for component product within parent product", 
                        "type": ["string", "null"], 
                        "pattern": "^[0-9]+$"
                      }, 
                      "productDescription": {
                        "description": "Description for component product within product management system (system where ordered line item products will be managed)", 
                        "type": ["string", "null"]
                      }, 
                      "productNumber": {
                        "description": "Name for component product within product management system (system where ordered line item products will be managed)", 
                        "type": ["string", "null"]
                      }, 
                      "productOwner": { "description": "Owner of component product", "type": ["string", "null"] }, 
                      "quantityBackordered": {
                        "description": "Amount of component product back-ordered within parent product", 
                        "type": ["integer", "null"], 
                        "format": "int32"
                      }, 
                      "quantityOrdered": {
                        "description": "Amount of component product ordered within parent product", 
                        "type": ["integer", "null"], 
                        "format": "int32"
                      }, 
                      "size": { "description": "Size of component product", "type": ["string", "null"] }
                    }, 
                    "required": ["productId"]
                  }
                }, 
                "pageCount": { "type": ["integer", "null"], "format": "int32" }, 
                "productDescription": { "type": ["string", "null"] }, 
                "productLineNumber": {
                  "description": "Line number reference to the parent offer line item", 
                  "type": ["string", "null"], 
                  "pattern": "^[0-9]+$"
                }, 
                "productNumber": { "type": ["string", "null"] }, 
                "productOwner": { "type": ["string", "null"] }, 
                "quantityOrdered": { "type": ["integer", "null"], "format": "int32" }, 
                "size": { "type": ["string", "null"] }
              }, 
              "required": ["productId"]
            }
          }, 
          "quantityOrdered": {
            "description": "Amount of offer ordered for individual line item", 
            "type": "integer", 
            "format": "int32"
          }, 
          "rushOrder": {
            "description": "True/false indicator if individual line item is expedited", 
            "type": ["boolean", "null"]
          }, 
          "shipToKey": {
            "description": "Unique ID for Order.ShipTos.Key property associated to individual line item (NOTE: If top-level DefaultShipToKey is not set, this must be.)", 
            "type": ["string", "null"], 
            "pattern": "^[0-9]+$"
          }, 
          "taxAmount": {
            "description": "Total tax amount applied to individual line item", 
            "type": ["number", "null"], 
            "format": "double"
          }
        }, 
        "required": ["lineItemFee", "price", "quantityOrdered", "taxAmount"]
      }, 
      "minItems": 1, 
      "uniqueItems": false
    }, 
    "orderFee": {
      "description": "Fee applied to Order", 
      "type": ["number", "null"], 
      "format": "double", 
      "minimum": 0
    }, 
    "orderVariables": {
      "description": "Manually entered variables for order within order management system (system where order lifecycle will be managed in)", 
      "oneOf": [ {"type": "null"}, {"type": "object"} ]
    }, 
    "orderedBys": {
      "description": "Order level ordered by contact and address details. Not required, but if present, each item must have required address fields and a non-null key.", 
      "oneOf": [
        {"type": "null"}, 
        {
          "type": "array", 
          "items": {
            "description": "Bill to address object for Order", 
            "type": "object", 
            "additionalProperties": false, 
            "properties": {
              "address1": {"description": "Address line 1 for address", "type": "string"}, 
              "address2": { "description": "Address line 2 for address", "type": ["string", "null"] }, 
              "address3": { "description": "Address line 3 for address", "type": ["string", "null"] }, 
              "addressCode": { "description": "Address code for address", "type": ["string", "null"] }, 
              "city": {"description": "City name for address", "type": "string"}, 
              "company": { "description": "Company name for address", "type": ["string", "null"] }, 
              "country": {"description": "Country name for address", "type": "string"}, 
              "emailAddress": {
                "description": "Contact email address for address", 
                "type": ["string", "null"]
              }, 
              "faxNumber": { "description": "Fax number for address", "type": ["string", "null"] }, 
              "key": {
                "description": "Unique ID for individual contact", 
                "type": "string", 
                "pattern": "^[0-9]+$"
              }, 
              "name": {"type": "string"}, 
              "phoneNumber": { "description": "Phone number for address", "type": ["string", "null"] }, 
              "postalCode": {"description": "Postal code for address", "type": "string"}, 
              "stateProvince": {"description": "State or province name for address", "type": "string"}
            }, 
            "required": ["address1", "city", "country", "name", "postalCode", "stateProvince"]
          }, 
          "minItems": 1
        }
      ]
    }, 
    "paymentMethods": {
      "description": "Order.ShipTos level payment method details", 
      "type": ["array", "null"], 
      "items": {
        "type": "object", 
        "additionalProperties": false, 
        "properties": {
          "amount": {
            "description": "Total Amount.  Required if MethodName specified", 
            "type": "number", 
            "format": "double"
          }, 
          "methodName": {
            "description": "Name of payment method.  Required if Payment Amount specified", 
            "type": "string"
          }
        }, 
        "required": ["amount", "methodName"]
      }
    }, 
    "pickPackHandlingFee": {
      "description": "Sum of pick & pack handling fees for all Order.ShipTos", 
      "type": ["number", "null"], 
      "format": "double", 
      "minimum": 0
    }, 
    "poNumber": {
      "description": "Purchase order number for Order. Maximum length 20 characters.", 
      "type": ["string", "null"], 
      "maxLength": 20
    }, 
    "rushOrder": {
      "description": "True/false indicator if Order is expedited", 
      "type": ["boolean", "null"]
    }, 
    "shipTos": {
      "description": "Order level ship to details. Required, must not be empty. Each item must have required address fields and a non-null key.", 
      "type": ["array", "null"], 
      "items": {
        "type": "object", 
        "additionalProperties": false, 
        "properties": {
          "affiliateId": { "type": ["string", "null"] }, 
          "referenceId": { "type": ["string", "null"] }, 
          "sourceSystemShippingMethodId": { "type": ["string", "null"] }, 
          "affiliateName": { "type": ["string", "null"] }, 
          "comment": { "type": ["string", "null"] }, 
          "costCenter": { "type": ["string", "null"] }, 
          "creditCardFee": { "type": ["number", "null"], "format": "double" }, 
          "dueDate": { "type": ["string", "null"] }, 
          "key": {
            "description": "Unique ID for individual ship to address", 
            "type": "string", 
            "pattern": "^[0-9]+$"
          }, 
          "orderFee": { "type": ["number", "null"], "format": "double" }, 
          "paymentMethods": {
            "type": ["array", "null"], 
            "items": {
              "type": "object", 
              "additionalProperties": false, 
              "properties": {
                "amount": {
                  "description": "Total Amount.  Required if MethodName specified", 
                  "type": "number", 
                  "format": "double"
                }, 
                "methodName": {
                  "description": "Name of payment method.  Required if Payment Amount specified", 
                  "type": "string"
                }
              }, 
              "required": ["amount", "methodName"]
            }
          }, 
          "pickPackHandlingFee": { "type": ["number", "null"], "format": "double" }, 
          "poNumber": { "type": ["string", "null"] }, 
          "rushOrder": { "type": ["boolean", "null"] }, 
          "shipToAddress": {
            "description": "Ship to addresses array for Order", 
            "type": "object", 
            "additionalProperties": false, 
            "properties": {
              "address1": {"description": "Address line 1 for address", "type": "string"}, 
              "address2": { "description": "Address line 2 for address", "type": ["string", "null"] }, 
              "address3": { "description": "Address line 3 for address", "type": ["string", "null"] }, 
              "addressCode": { "description": "Address code for address", "type": ["string", "null"] }, 
              "city": {"description": "City name for address", "type": "string"}, 
              "company": { "description": "Company name for address", "type": ["string", "null"] }, 
              "country": {"description": "Country name for address", "type": "string"}, 
              "emailAddress": {
                "description": "Contact email address for address", 
                "type": ["string", "null"]
              }, 
              "faxNumber": { "description": "Fax number for address", "type": ["string", "null"] }, 
              "name": {"type": "string"}, 
              "phoneNumber": { "description": "Phone number for address", "type": ["string", "null"] }, 
              "postalCode": {"description": "Postal code for address", "type": "string"}, 
              "stateProvince": {"description": "State or province name for address", "type": "string"}
            }, 
            "required": ["address1", "city", "country", "name", "postalCode", "stateProvince"]
          }, 
          "shippingCost": { "type": ["number", "null"], "format": "double" }, 
          "shippingHandlingTax": { "type": ["number", "null"], "format": "double" }, 
          "totalOrderFee": { "type": ["number", "null"], "format": "double" }
        }, 
        "required": ["key"]
      }, 
      "minItems": 1, 
      "uniqueItems": false
    }, 
    "shippingHandlingTax": {
      "description": "Sum of shipping & handling taxes for all Order.ShipTos. Required, must not be null.", 
      "type": "number", 
      "format": "double", 
      "minimum": 0
    }, 
    "totalOrderFee": {
      "description": "Sum of OrderFee", 
      "type": ["number", "null"], 
      "format": "double", 
      "minimum": 0
    }, 
    "totalShippingCost": {
      "description": "Sum of shipping cost for all Order.ShipTos.Shipments", 
      "type": ["number", "null"], 
      "format": "double", 
      "minimum": 0
    }
  }, 
  "required": ["orderId", "createDateTime", "lineItems", "billTos", "shipTos"], 
  "allOf": [
    {
      "description": "Either a defaultBillToKey must be provided, or the billTos array must be populated.", 
      "oneOf": [
        {
          "properties": { "defaultBillToKey": {"type": "string"} }, 
          "required": ["defaultBillToKey"]
        }, 
        {
          "properties": { "billTos": {"type": "array", "minItems": 1} }, 
          "required": ["billTos"]
        }
      ]
    }, 
    {
      "description": "Either a defaultShipToKey must be provided, or the shipTos array must be populated.", 
      "oneOf": [
        {
          "properties": { "defaultShipToKey": {"type": "string"} }, 
          "required": ["defaultShipToKey"]
        }, 
        {
          "properties": { "shipTos": {"type": "array", "minItems": 1} }, 
          "required": ["shipTos"]
        }
      ]
    }, 
    {
      "description": "If a defaultBillToKey is not provided at the root, each line item must specify a billToKey.", 
      "oneOf": [
        {
          "properties": { "defaultBillToKey": {"type": "string"} }, 
          "required": ["defaultBillToKey"]
        }, 
        {
          "properties": {
            "lineItems": {
              "type": ["array", "null"], 
              "items": {
                "type": "object", 
                "properties": { "billToKey": {"type": "string"} }, 
                "required": ["billToKey"]
              }
            }
          }
        }
      ]
    }, 
    {
      "description": "If a defaultShipToKey is not provided at the root, each line item must specify a shipToKey.", 
      "oneOf": [
        {
          "properties": { "defaultShipToKey": {"type": "string"} }, 
          "required": ["defaultShipToKey"]
        }, 
        {
          "properties": {
            "lineItems": {
              "type": ["array", "null"], 
              "items": { "properties": { "shipToKey": {"type": "string"} }, "required": ["shipToKey"] }
            }
          }
        }
      ]
    }, 
    {
      "description": "If a defaultOrderedByKey is not provided at the root, each line item must specify an orderedByKey.", 
      "oneOf": [
        {
          "properties": { "defaultOrderedByKey": {"type": "string"} }, 
          "required": ["defaultOrderedByKey"]
        }, 
        {
          "properties": {
            "lineItems": {
              "type": ["array", "null"], 
              "items": {
                "properties": { "orderedByKey": {"type": "string"} }, 
                "required": ["orderedByKey"]
              }
            }
          }
        }, 
        {
          "properties": {
            "defaultOrderedByKey": {"type": "null"}, 
            "orderedBys": { "oneOf": [ {"type": "null"}, {"type": "array", "maxItems": 0} ] }
          }, 
          "required": ["defaultOrderedByKey", "orderedBys"]
        }
      ]
    }, 
    {
      "properties": {
        "lineItems": {
          "type": ["array", "null"], 
          "items": {
            "type": "object", 
            "properties": { "offerLineNumber": {"type": "string", "minLength": 1} }, 
            "required": ["offerLineNumber"]
          }
        }
      }
    }
  ], 
  "examples": [
    {
      "orderId": "7-mkkutsde-3-K-5649-4005-64", 
      "referenceId": "OWMR WSKFA - LNSSZT XBUUJ & MS XXQ QCHX", 
      "accessGroups": ["TS-Retail", "CDM Tuff Shed", "Tuff shed Act on behalf and see all orders"], 
      "affiliateIdentifier": "QJ-987", 
      "affiliateName": "UJ-143-ABWJINHFVL, QD", 
      "billTos": [
        {
          "address1": "16013 Valenzuela Turnpike", 
          "address2": null, 
          "address3": null, 
          "city": "Rosaleshaven", 
          "company": "Rosales-Shea", 
          "country": "USA", 
          "emailAddress": "chelseamiller@example.org", 
          "faxNumber": "", 
          "key": "0", 
          "name": "Gail Stewart", 
          "phoneNumber": "411-770-8380", 
          "postalCode": "12507", 
          "stateProvince": "Washington"
        }
      ], 
      "costCenter": "020 - Denver", 
      "createDateTime": "2025-02-28T20:37:42.018+00:00", 
      "creditCardFee": 0.0, 
      "dueDate": null, 
      "lineItems": [
        {
          "offerId": "t87grb75-e9pe-5405-y8yv-25n5q70bu93i", 
          "referenceId": "BEHZ QUJNS - TPGJXT MMGVN & UX ZDN HHQS", 
          "variableTemplatePrintId": null, 
          "additionalProperties": [], 
          "billToKey": "0", 
          "comment": null, 
          "costCenter": "020 - Denver", 
          "dueDate": null, 
          "lineItemFee": 0.75, 
          "offerDescription": "<p>$17.00 Each \u2013 S - XL<br>\n$20.00 Each \u2013 2XL - XLarge/Tall Sizes<br>\n$21.50 Each \u2013 3XL - 2XLarge/Tall sizes<br>$25.00 Each - 4XL Sizes - 3XL tall <br>$35.00 Each - 5XL Sizes<br><br></p>", 
          "offerLineNumber": "0", 
          "offerNumber": "TS_A-A0050", 
          "orderedByKey": "0", 
          "poNumber": null, 
          "price": 17.0, 
          "products": [
            {
              "productId": "3j8hu98q-s0t6-409v-029r-321r0uo02k30", 
              "associatedFileName": "", 
              "color": null, 
              "comment": null, 
              "components": [], 
              "productDescription": "8\"x8\" square paint swatch.", 
              "productLineNumber": "1", 
              "productNumber": "R_962_24008_TSO", 
              "productOwner": null, 
              "quantityOrdered": null, 
              "size": null
            }, 
            {
              "productId": "7jv34sz5-m4q8-8q8f-187d-jt7791j02958", 
              "associatedFileName": "", 
              "color": null, 
              "comment": null, 
              "components": [], 
              "productDescription": "Tuff Shed Men's Polo", 
              "productLineNumber": "2", 
              "productNumber": "TS_A-A0050", 
              "productOwner": null, 
              "quantityOrdered": null, 
              "size": null
            }
          ], 
          "quantityOrdered": 1, 
          "rushOrder": false, 
          "shipToKey": "0", 
          "taxAmount": 0.0
        }
      ], 
      "orderFee": 4.0, 
      "orderVariables": {}, 
      "orderedBys": [
        {
          "address1": "42801 Pamela Run", 
          "address2": null, 
          "address3": null, 
          "city": "Port Rickside", 
          "company": "Trujillo-Sims", 
          "country": "USA", 
          "emailAddress": "jonesjeff@example.net", 
          "faxNumber": "", 
          "key": "0", 
          "name": "Benjamin Smith", 
          "phoneNumber": "+1-310-761-3615x7115", 
          "postalCode": "10330", 
          "stateProvince": "California"
        }
      ], 
      "paymentMethods": [ {"amount": 35.8, "methodName": "invoice"} ], 
      "pickPackHandlingFee": 0.75, 
      "poNumber": null, 
      "rushOrder": false, 
      "shipTos": [
        {
          "affiliateId": "EK-023", 
          "referenceId": "QGSN VNSAH - PWJRVG OCYIA & PG GAE RZTN", 
          "sourceSystemShippingMethodId": "qnigy_cxdcmo", 
          "affiliateName": "JK-467-WLTQIEOCCZ, PA", 
          "comment": null, 
          "costCenter": "020 - Denver", 
          "creditCardFee": 0.0, 
          "dueDate": null, 
          "key": "0", 
          "orderFee": 4.0, 
          "paymentMethods": [], 
          "pickPackHandlingFee": 0.75, 
          "poNumber": null, 
          "rushOrder": false, 
          "shipToAddress": {
            "address1": "130 Owen Gateway", 
            "address2": null, 
            "address3": null, 
            "city": "Arthurborough", 
            "company": "Bryant-Compton", 
            "country": "USA", 
            "emailAddress": "yduran@example.com", 
            "faxNumber": "", 
            "name": "Patricia Parker", 
            "phoneNumber": "317.410.1217", 
            "postalCode": "96718", 
            "stateProvince": "Georgia"
          }, 
          "shippingCost": 13.66, 
          "shippingHandlingTax": 0.39, 
          "totalOrderFee": 4.0
        }
      ], 
      "shippingHandlingTax": 0.39, 
      "totalOrderFee": 4.0, 
      "totalShippingCost": 13.66
    }
  ]
}