Skip to content

InvoiceView

Invoice View payload written by Snowflake to Cosmos.

Properties

  • Invoice (object)A single 810 invoice record. Invoices are generated per shipment. One order may produce multiple invoices if goods ship in multiple shipments (Kohler) or a single invoice per order (AGCO, Rehlko). Cannot contain additional properties.

    • SourceSystemCustomerId (string)This is an automatically generated field added by middleware. It is considered read-only.
    • BillTo (object)Billing party. Required for Rehlko and Kohler. Sourced from the OrderEvent. Cannot contain additional properties.

      • AddressCode (['string', 'null'])Division or department code sent by the customer on the original order. Kohler values: PNA1 (Plumbing), ENG1 (Engines), HSP1 (Hospitality), COR1 (Corporate).
      • Company (['string', 'null'])Bill-to company name.
    • CreateDateTime (string, format: date, required)Original PO date in YYYY-MM-DD format. Sourced from the OrderEvent.

    • Currency (string, required)ISO 4217 currency code. Static per customer configuration. Must be one of: ["USD", "CAD"].
    • InvoiceDate (string, format: date, required)Invoice date in YYYY-MM-DD format. Generated by Slingshot.
    • InvoiceNumber (string, required)Unique invoice identifier generated by Slingshot. Must be unique across all invoices.
    • InvoiceTotal (number, required)Total invoice amount in dollars. Calculated as the sum of line item prices. No mechanism exists for fees, tax, or freight — those are excluded from current implementations. Exclusive minimum: 0.
    • PONumber (string, required)Customer's purchase order number from the original order event. Must match a valid PO in the system.
    • PaymentTerms (['string', 'null'])Payment terms string. Required for AGCO, Rehlko, Kohler, and PetSmart. Sourced from Slingshot.
    • Shipments (array, required)Shipment-level records. AGCO and Rehlko produce one shipment per invoice (one invoice per order). Kohler produces one invoice per physical shipment — if an order ships in 3 packages with different tracking numbers, this array contains 3 elements across 3 separate Invoice records. Length must be at least 1.

      • Items (object)A single shipment within an invoice. For Kohler, each shipment corresponds to a distinct carrier tracking number. For AGCO and Rehlko there is effectively one shipment per invoice. Cannot contain additional properties.

        • LineItems (array, required)One or more line items invoiced in this shipment. Length must be at least 1.

          • Items (object)A single invoiced line within a shipment. Current scope supports line item totals only; there is no mechanism for order fees, tax, or shipping costs. Cannot contain additional properties.

            • AdditionalProperties (object)Customer-specific EDI qualifier fields attached to a line item. For PetSmart, these values must exactly match what was received on the original 850 purchase order. Cannot contain additional properties.

              • edi_productServiceIDQualifier_BP (['string', 'null'])Buyer's part number / article number (BP qualifier). Required for PetSmart. Sourced from the OrderEvent AdditionalProperties.
              • edi_productServiceIDQualifier_UP (['string', 'null'])UPC/EAN barcode (UP qualifier). Required for PetSmart. Sourced from the OrderEvent AdditionalProperties.
            • LineItemDescription (['string', 'null'])Optional description for the line item (e.g., a fee label). Sourced from Slingshot.

            • OfferLineNumber (['string', 'null'])Line sequence number from the OrderEvent. Required for all customers except PetSmart; blank for PetSmart.
            • OfferNumber (string, required)Customer's part number from the original PO (OrderEvent). Must exactly match what was received on the 850 for PetSmart.
            • Price (number, required)Line total in dollars (QuantityShipped × UnitPrice). Must be a positive decimal. Sourced from the OrderEvent. Exclusive minimum: 0.
            • QuantityShipped (integer, required)Quantity invoiced. Must be a positive integer. Sourced from the OrderEvent. Minimum: 1.
            • UnitPrice (number, required)Unit price in dollars. Must be a positive decimal. Sourced from the OrderEvent. Exclusive minimum: 0.
        • MasterTrackingNumber (['string', 'null'])Carrier tracking number for this shipment. Required for Kohler; null/blank for all other customers. Sourced from the OrderEvent. Used to match the invoice to a specific package.

        • PackingSlipNumber (['string', 'null'])BOL or packing slip number. Required for AGCO and Rehlko. Null/blank for Kohler and PetSmart. Sourced from the OrderEvent.
        • ShipDateUtc (['string', 'null'], format: date)Ship date for this shipment in YYYY-MM-DD format. Required for Kohler; null/blank for others. Sourced from the OrderEvent.
        • ShipTo (object, required)Destination ship-to address. Full address fields (Company, Address1, City, StateProvince, PostalCode, Country) are required for AGCO; null/blank for others. Sourced from the OrderEvent Shipment. Cannot contain additional properties.

          • Address1 (['string', 'null'])Street address. Required for AGCO; blank for others.
          • AddressCode (['string', 'null'])Location or site code from the ShipTo on the OrderEvent. PetSmart codes must be exactly 4 digits with leading zeros (e.g., '0012', not '12').
          • City (['string', 'null'])City. Required for AGCO; blank for others.
          • Company (['string', 'null'])Destination company name. Required for AGCO; blank for others.
          • Country (['string', 'null'])ISO country code. Required for AGCO; blank for others.
          • PostalCode (['string', 'null'])Postal/ZIP code. Required for AGCO; blank for others.
          • StateProvince (['string', 'null'])State or province code. Required for AGCO; blank for others.
  • BillToAddress (object)Billing party. Required for Rehlko and Kohler. Sourced from the OrderEvent. Cannot contain additional properties.

    • AddressCode (['string', 'null'])Division or department code sent by the customer on the original order. Kohler values: PNA1 (Plumbing), ENG1 (Engines), HSP1 (Hospitality), COR1 (Corporate).
    • Company (['string', 'null'])Bill-to company name.
  • LineItem (object)A single invoiced line within a shipment. Current scope supports line item totals only; there is no mechanism for order fees, tax, or shipping costs. Cannot contain additional properties.

    • AdditionalProperties (object)Customer-specific EDI qualifier fields attached to a line item. For PetSmart, these values must exactly match what was received on the original 850 purchase order. Cannot contain additional properties.

      • edi_productServiceIDQualifier_BP (['string', 'null'])Buyer's part number / article number (BP qualifier). Required for PetSmart. Sourced from the OrderEvent AdditionalProperties.
      • edi_productServiceIDQualifier_UP (['string', 'null'])UPC/EAN barcode (UP qualifier). Required for PetSmart. Sourced from the OrderEvent AdditionalProperties.
    • LineItemDescription (['string', 'null'])Optional description for the line item (e.g., a fee label). Sourced from Slingshot.

    • OfferLineNumber (['string', 'null'])Line sequence number from the OrderEvent. Required for all customers except PetSmart; blank for PetSmart.
    • OfferNumber (string, required)Customer's part number from the original PO (OrderEvent). Must exactly match what was received on the 850 for PetSmart.
    • Price (number, required)Line total in dollars (QuantityShipped × UnitPrice). Must be a positive decimal. Sourced from the OrderEvent. Exclusive minimum: 0.
    • QuantityShipped (integer, required)Quantity invoiced. Must be a positive integer. Sourced from the OrderEvent. Minimum: 1.
    • UnitPrice (number, required)Unit price in dollars. Must be a positive decimal. Sourced from the OrderEvent. Exclusive minimum: 0.
  • LineItemAdditionalProperties (object)Customer-specific EDI qualifier fields attached to a line item. For PetSmart, these values must exactly match what was received on the original 850 purchase order. Cannot contain additional properties.

    • edi_productServiceIDQualifier_BP (['string', 'null'])Buyer's part number / article number (BP qualifier). Required for PetSmart. Sourced from the OrderEvent AdditionalProperties.
    • edi_productServiceIDQualifier_UP (['string', 'null'])UPC/EAN barcode (UP qualifier). Required for PetSmart. Sourced from the OrderEvent AdditionalProperties.
  • ShipToAddress (object)Destination ship-to address. Full address fields (Company, Address1, City, StateProvince, PostalCode, Country) are required for AGCO; null/blank for others. Sourced from the OrderEvent Shipment. Cannot contain additional properties.

    • Address1 (['string', 'null'])Street address. Required for AGCO; blank for others.
    • AddressCode (['string', 'null'])Location or site code from the ShipTo on the OrderEvent. PetSmart codes must be exactly 4 digits with leading zeros (e.g., '0012', not '12').
    • City (['string', 'null'])City. Required for AGCO; blank for others.
    • Company (['string', 'null'])Destination company name. Required for AGCO; blank for others.
    • Country (['string', 'null'])ISO country code. Required for AGCO; blank for others.
    • PostalCode (['string', 'null'])Postal/ZIP code. Required for AGCO; blank for others.
    • StateProvince (['string', 'null'])State or province code. Required for AGCO; blank for others.
  • Shipment (object)A single shipment within an invoice. For Kohler, each shipment corresponds to a distinct carrier tracking number. For AGCO and Rehlko there is effectively one shipment per invoice. Cannot contain additional properties.

    • LineItems (array, required)One or more line items invoiced in this shipment. Length must be at least 1.

      • Items (object)A single invoiced line within a shipment. Current scope supports line item totals only; there is no mechanism for order fees, tax, or shipping costs. Cannot contain additional properties.

        • AdditionalProperties (object)Customer-specific EDI qualifier fields attached to a line item. For PetSmart, these values must exactly match what was received on the original 850 purchase order. Cannot contain additional properties.

          • edi_productServiceIDQualifier_BP (['string', 'null'])Buyer's part number / article number (BP qualifier). Required for PetSmart. Sourced from the OrderEvent AdditionalProperties.
          • edi_productServiceIDQualifier_UP (['string', 'null'])UPC/EAN barcode (UP qualifier). Required for PetSmart. Sourced from the OrderEvent AdditionalProperties.
        • LineItemDescription (['string', 'null'])Optional description for the line item (e.g., a fee label). Sourced from Slingshot.

        • OfferLineNumber (['string', 'null'])Line sequence number from the OrderEvent. Required for all customers except PetSmart; blank for PetSmart.
        • OfferNumber (string, required)Customer's part number from the original PO (OrderEvent). Must exactly match what was received on the 850 for PetSmart.
        • Price (number, required)Line total in dollars (QuantityShipped × UnitPrice). Must be a positive decimal. Sourced from the OrderEvent. Exclusive minimum: 0.
        • QuantityShipped (integer, required)Quantity invoiced. Must be a positive integer. Sourced from the OrderEvent. Minimum: 1.
        • UnitPrice (number, required)Unit price in dollars. Must be a positive decimal. Sourced from the OrderEvent. Exclusive minimum: 0.
    • MasterTrackingNumber (['string', 'null'])Carrier tracking number for this shipment. Required for Kohler; null/blank for all other customers. Sourced from the OrderEvent. Used to match the invoice to a specific package.

    • PackingSlipNumber (['string', 'null'])BOL or packing slip number. Required for AGCO and Rehlko. Null/blank for Kohler and PetSmart. Sourced from the OrderEvent.
    • ShipDateUtc (['string', 'null'], format: date)Ship date for this shipment in YYYY-MM-DD format. Required for Kohler; null/blank for others. Sourced from the OrderEvent.
    • ShipTo (object, required)Destination ship-to address. Full address fields (Company, Address1, City, StateProvince, PostalCode, Country) are required for AGCO; null/blank for others. Sourced from the OrderEvent Shipment. Cannot contain additional properties.

      • Address1 (['string', 'null'])Street address. Required for AGCO; blank for others.
      • AddressCode (['string', 'null'])Location or site code from the ShipTo on the OrderEvent. PetSmart codes must be exactly 4 digits with leading zeros (e.g., '0012', not '12').
      • City (['string', 'null'])City. Required for AGCO; blank for others.
      • Company (['string', 'null'])Destination company name. Required for AGCO; blank for others.
      • Country (['string', 'null'])ISO country code. Required for AGCO; blank for others.
      • PostalCode (['string', 'null'])Postal/ZIP code. Required for AGCO; blank for others.
      • StateProvince (['string', 'null'])State or province code. Required for AGCO; blank for others.

Quicktype Command

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

namespace OtpSchema.Event.Customer.InvoiceView
{
    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>Invoice View payload written by Snowflake to Cosmos.</summary>
    public partial class InvoiceView
    {
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)][J("Invoice")] public Invoice Invoice { get; set; } // A single 810 invoice record. Invoices are generated per shipment. One order may produce; multiple invoices if goods ship in multiple shipments (Kohler) or a single invoice per; order (AGCO, Rehlko).
    }

    /// <summary>A single 810 invoice record. Invoices are generated per shipment. One order may produce; multiple invoices if goods ship in multiple shipments (Kohler) or a single invoice per; order (AGCO, Rehlko).</summary>
    public partial class Invoice
    {
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)][J("BillTo")]                 public BillToAddress BillTo { get; set; }          // Billing party. Required for Rehlko and Kohler. Sourced from the OrderEvent.
        [J("CreateDateTime")]                                                                      public DateTimeOffset CreateDateTime { get; set; } // Original PO date in YYYY-MM-DD format. Sourced from the OrderEvent.
        [J("Currency")]                                                                            public Currency Currency { get; set; }             // ISO 4217 currency code. Static per customer configuration.
        [J("InvoiceDate")]                                                                         public DateTimeOffset InvoiceDate { get; set; }    // Invoice date in YYYY-MM-DD format. Generated by Slingshot.
        [J("InvoiceNumber")]                                                                       public string InvoiceNumber { get; set; }          // Unique invoice identifier generated by Slingshot. Must be unique across all invoices.
        [J("InvoiceTotal")]                                                                        public double InvoiceTotal { get; set; }           // Total invoice amount in dollars. Calculated as the sum of line item prices. No mechanism; exists for fees, tax, or freight — those are excluded from current implementations.
        [J("PaymentTerms")]                                                                        public string PaymentTerms { get; set; }           // Payment terms string. Required for AGCO, Rehlko, Kohler, and PetSmart. Sourced from; Slingshot.
        [J("PONumber")]                                                                            public string PoNumber { get; set; }               // Customer's purchase order number from the original order event. Must match a valid PO in; the system.
        [J("Shipments")]                                                                           public Shipment[]? Shipments { get; set; }          // Shipment-level records. AGCO and Rehlko produce one shipment per invoice (one invoice per; order). Kohler produces one invoice per physical shipment — if an order ships in 3; packages with different tracking numbers, this array contains 3 elements across 3; separate Invoice records.
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)][J("SourceSystemCustomerId")] public string SourceSystemCustomerId { get; set; } // This is an automatically generated field added by middleware.  It is considered read-only
    }

    /// <summary>Billing party. Required for Rehlko and Kohler. Sourced from the OrderEvent.</summary>
    public partial class BillToAddress
    {
        [J("AddressCode")] public string AddressCode { get; set; } // Division or department code sent by the customer on the original order. Kohler values:; PNA1 (Plumbing), ENG1 (Engines), HSP1 (Hospitality), COR1 (Corporate).
        [J("Company")]     public string Company { get; set; }     // Bill-to company name.
    }

    /// <summary>A single shipment within an invoice. For Kohler, each shipment corresponds to a distinct; carrier tracking number. For AGCO and Rehlko there is effectively one shipment per; invoice.</summary>
    public partial class Shipment
    {
        [J("LineItems")]            public LineItem[]? LineItems { get; set; }        // One or more line items invoiced in this shipment.
        [J("MasterTrackingNumber")] public string MasterTrackingNumber { get; set; } // Carrier tracking number for this shipment. Required for Kohler; null/blank for all other; customers. Sourced from the OrderEvent. Used to match the invoice to a specific package.
        [J("PackingSlipNumber")]    public string PackingSlipNumber { get; set; }    // BOL or packing slip number. Required for AGCO and Rehlko. Null/blank for Kohler and; PetSmart. Sourced from the OrderEvent.
        [J("ShipDateUtc")]          public DateTimeOffset? ShipDateUtc { get; set; } // Ship date for this shipment in YYYY-MM-DD format. Required for Kohler; null/blank for; others. Sourced from the OrderEvent.
        [J("ShipTo")]               public ShipToAddress ShipTo { get; set; }        // Destination ship-to address. Full address fields (Company, Address1, City, StateProvince,; PostalCode, Country) are required for AGCO; null/blank for others. Sourced from the; OrderEvent Shipment.
    }

    /// <summary>A single invoiced line within a shipment. Current scope supports line item totals only;; there is no mechanism for order fees, tax, or shipping costs.</summary>
    public partial class LineItem
    {
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)][J("AdditionalProperties")] public LineItemAdditionalProperties AdditionalProperties { get; set; } // Customer-specific EDI qualifier fields attached to a line item. For PetSmart, these; values must exactly match what was received on the original 850 purchase order.
        [J("LineItemDescription")]                                                               public string LineItemDescription { get; set; }                        // Optional description for the line item (e.g., a fee label). Sourced from Slingshot.
        [J("OfferLineNumber")]                                                                   public string OfferLineNumber { get; set; }                            // Line sequence number from the OrderEvent. Required for all customers except PetSmart;; blank for PetSmart.
        [J("OfferNumber")]                                                                       public string OfferNumber { get; set; }                                // Customer's part number from the original PO (OrderEvent). Must exactly match what was; received on the 850 for PetSmart.
        [J("Price")]                                                                             public double Price { get; set; }                                      // Line total in dollars (QuantityShipped × UnitPrice). Must be a positive decimal. Sourced; from the OrderEvent.
        [J("QuantityShipped")]                                                                   public long QuantityShipped { get; set; }                              // Quantity invoiced. Must be a positive integer. Sourced from the OrderEvent.
        [J("UnitPrice")]                                                                         public double UnitPrice { get; set; }                                  // Unit price in dollars. Must be a positive decimal. Sourced from the OrderEvent.
    }

    /// <summary>Customer-specific EDI qualifier fields attached to a line item. For PetSmart, these; values must exactly match what was received on the original 850 purchase order.</summary>
    public partial class LineItemAdditionalProperties
    {
        [J("edi_productServiceIDQualifier_BP")] public string EdiProductServiceIdQualifierBp { get; set; } // Buyer's part number / article number (BP qualifier). Required for PetSmart. Sourced from; the OrderEvent AdditionalProperties.
        [J("edi_productServiceIDQualifier_UP")] public string EdiProductServiceIdQualifierUp { get; set; } // UPC/EAN barcode (UP qualifier). Required for PetSmart. Sourced from the OrderEvent; AdditionalProperties.
    }

    /// <summary>Destination ship-to address. Full address fields (Company, Address1, City, StateProvince,; PostalCode, Country) are required for AGCO; null/blank for others. Sourced from the; OrderEvent Shipment.</summary>
    public partial class ShipToAddress
    {
        [J("Address1")]      public string Address1 { get; set; }      // Street address. Required for AGCO; blank for others.
        [J("AddressCode")]   public string AddressCode { get; set; }   // Location or site code from the ShipTo on the OrderEvent. PetSmart codes must be exactly 4; digits with leading zeros (e.g., '0012', not '12').
        [J("City")]          public string City { get; set; }          // City. Required for AGCO; blank for others.
        [J("Company")]       public string Company { get; set; }       // Destination company name. Required for AGCO; blank for others.
        [J("Country")]       public string Country { get; set; }       // ISO country code. Required for AGCO; blank for others.
        [J("PostalCode")]    public string PostalCode { get; set; }    // Postal/ZIP code. Required for AGCO; blank for others.
        [J("StateProvince")] public string StateProvince { get; set; } // State or province code. Required for AGCO; blank for others.
    }

    /// <summary>ISO 4217 currency code. Static per customer configuration.</summary>
    public enum Currency { Cad, Usd };

    public partial class InvoiceView
    {
        public static InvoiceView FromJson(string json) => JsonSerializer.Deserialize<InvoiceView>(json, OtpSchema.Event.Customer.InvoiceView.Converter.Settings);
    }

    public static class Serialize
    {
        public static string ToJson(this InvoiceView self) => JsonSerializer.Serialize(self, OtpSchema.Event.Customer.InvoiceView.Converter.Settings);
    }

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

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

        public override Currency Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
        {
            var value = reader.GetString();
            switch (value)
            {
                case "CAD":
                    return Currency.Cad;
                case "USD":
                    return Currency.Usd;
            }
            throw new Exception("Cannot unmarshal type Currency");
        }

        public override void Write(Utf8JsonWriter writer, Currency value, JsonSerializerOptions options)
        {
            switch (value)
            {
                case Currency.Cad:
                    JsonSerializer.Serialize(writer, "CAD", options);
                    return;
                case Currency.Usd:
                    JsonSerializer.Serialize(writer, "USD", options);
                    return;
            }
            throw new Exception("Cannot marshal type Currency");
        }

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

    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

InvoiceView
{
  "$schema": "http://json-schema.org/draft-07/schema#", 
  "$id": "InvoiceView.json", 
  "description": "Invoice View payload written by Snowflake to Cosmos.", 
  "type": "object", 
  "additionalProperties": false, 
  "properties": {
    "Invoice": {
      "description": "A single 810 invoice record. Invoices are generated per shipment. One order may produce multiple invoices if goods ship in multiple shipments (Kohler) or a single invoice per order (AGCO, Rehlko).", 
      "type": "object", 
      "additionalProperties": false, 
      "title": "Invoice", 
      "properties": {
        "SourceSystemCustomerId": {
          "description": "This is an automatically generated field added by middleware.  It is considered read-only", 
          "type": "string", 
          "readonly": true
        }, 
        "BillTo": {
          "description": "Billing party. Required for Rehlko and Kohler. Sourced from the OrderEvent.", 
          "type": "object", 
          "additionalProperties": false, 
          "title": "BillTo Address", 
          "properties": {
            "AddressCode": {
              "description": "Division or department code sent by the customer on the original order. Kohler values: PNA1 (Plumbing), ENG1 (Engines), HSP1 (Hospitality), COR1 (Corporate).", 
              "type": ["string", "null"]
            }, 
            "Company": { "description": "Bill-to company name.", "type": ["string", "null"] }
          }
        }, 
        "CreateDateTime": {
          "description": "Original PO date in YYYY-MM-DD format. Sourced from the OrderEvent.", 
          "type": "string", 
          "format": "date"
        }, 
        "Currency": {
          "description": "ISO 4217 currency code. Static per customer configuration.", 
          "type": "string", 
          "enum": ["USD", "CAD"]
        }, 
        "InvoiceDate": {
          "description": "Invoice date in YYYY-MM-DD format. Generated by Slingshot.", 
          "type": "string", 
          "format": "date"
        }, 
        "InvoiceNumber": {
          "description": "Unique invoice identifier generated by Slingshot. Must be unique across all invoices.", 
          "type": "string"
        }, 
        "InvoiceTotal": {
          "description": "Total invoice amount in dollars. Calculated as the sum of line item prices. No mechanism exists for fees, tax, or freight \u2014 those are excluded from current implementations.", 
          "type": "number", 
          "exclusiveMinimum": 0
        }, 
        "PONumber": {
          "description": "Customer's purchase order number from the original order event. Must match a valid PO in the system.", 
          "type": "string"
        }, 
        "PaymentTerms": {
          "description": "Payment terms string. Required for AGCO, Rehlko, Kohler, and PetSmart. Sourced from Slingshot.", 
          "type": ["string", "null"]
        }, 
        "Shipments": {
          "description": "Shipment-level records. AGCO and Rehlko produce one shipment per invoice (one invoice per order). Kohler produces one invoice per physical shipment \u2014 if an order ships in 3 packages with different tracking numbers, this array contains 3 elements across 3 separate Invoice records.", 
          "type": "array", 
          "items": {
            "description": "A single shipment within an invoice. For Kohler, each shipment corresponds to a distinct carrier tracking number. For AGCO and Rehlko there is effectively one shipment per invoice.", 
            "type": "object", 
            "additionalProperties": false, 
            "title": "Shipment", 
            "properties": {
              "LineItems": {
                "description": "One or more line items invoiced in this shipment.", 
                "type": "array", 
                "items": {
                  "description": "A single invoiced line within a shipment. Current scope supports line item totals only; there is no mechanism for order fees, tax, or shipping costs.", 
                  "type": "object", 
                  "additionalProperties": false, 
                  "title": "Line Item", 
                  "properties": {
                    "AdditionalProperties": {
                      "description": "Customer-specific EDI qualifier fields attached to a line item. For PetSmart, these values must exactly match what was received on the original 850 purchase order.", 
                      "type": "object", 
                      "additionalProperties": false, 
                      "title": "Line Item Additional Properties", 
                      "properties": {
                        "edi_productServiceIDQualifier_BP": {
                          "description": "Buyer's part number / article number (BP qualifier). Required for PetSmart. Sourced from the OrderEvent AdditionalProperties.", 
                          "type": ["string", "null"]
                        }, 
                        "edi_productServiceIDQualifier_UP": {
                          "description": "UPC/EAN barcode (UP qualifier). Required for PetSmart. Sourced from the OrderEvent AdditionalProperties.", 
                          "type": ["string", "null"]
                        }
                      }
                    }, 
                    "LineItemDescription": {
                      "description": "Optional description for the line item (e.g., a fee label). Sourced from Slingshot.", 
                      "type": ["string", "null"]
                    }, 
                    "OfferLineNumber": {
                      "description": "Line sequence number from the OrderEvent. Required for all customers except PetSmart; blank for PetSmart.", 
                      "type": ["string", "null"]
                    }, 
                    "OfferNumber": {
                      "description": "Customer's part number from the original PO (OrderEvent). Must exactly match what was received on the 850 for PetSmart.", 
                      "type": "string"
                    }, 
                    "Price": {
                      "description": "Line total in dollars (QuantityShipped \u00d7 UnitPrice). Must be a positive decimal. Sourced from the OrderEvent.", 
                      "type": "number", 
                      "exclusiveMinimum": 0
                    }, 
                    "QuantityShipped": {
                      "description": "Quantity invoiced. Must be a positive integer. Sourced from the OrderEvent.", 
                      "type": "integer", 
                      "minimum": 1
                    }, 
                    "UnitPrice": {
                      "description": "Unit price in dollars. Must be a positive decimal. Sourced from the OrderEvent.", 
                      "type": "number", 
                      "exclusiveMinimum": 0
                    }
                  }, 
                  "required": ["QuantityShipped", "UnitPrice", "OfferNumber", "Price"]
                }, 
                "minItems": 1
              }, 
              "MasterTrackingNumber": {
                "description": "Carrier tracking number for this shipment. Required for Kohler; null/blank for all other customers. Sourced from the OrderEvent. Used to match the invoice to a specific package.", 
                "type": ["string", "null"]
              }, 
              "PackingSlipNumber": {
                "description": "BOL or packing slip number. Required for AGCO and Rehlko. Null/blank for Kohler and PetSmart. Sourced from the OrderEvent.", 
                "type": ["string", "null"]
              }, 
              "ShipDateUtc": {
                "description": "Ship date for this shipment in YYYY-MM-DD format. Required for Kohler; null/blank for others. Sourced from the OrderEvent.", 
                "type": ["string", "null"], 
                "format": "date"
              }, 
              "ShipTo": {
                "description": "Destination ship-to address. Full address fields (Company, Address1, City, StateProvince, PostalCode, Country) are required for AGCO; null/blank for others. Sourced from the OrderEvent Shipment.", 
                "type": "object", 
                "additionalProperties": false, 
                "title": "ShipTo Address", 
                "properties": {
                  "Address1": {
                    "description": "Street address. Required for AGCO; blank for others.", 
                    "type": ["string", "null"]
                  }, 
                  "AddressCode": {
                    "description": "Location or site code from the ShipTo on the OrderEvent. PetSmart codes must be exactly 4 digits with leading zeros (e.g., '0012', not '12').", 
                    "type": ["string", "null"]
                  }, 
                  "City": {
                    "description": "City. Required for AGCO; blank for others.", 
                    "type": ["string", "null"]
                  }, 
                  "Company": {
                    "description": "Destination company name. Required for AGCO; blank for others.", 
                    "type": ["string", "null"]
                  }, 
                  "Country": {
                    "description": "ISO country code. Required for AGCO; blank for others.", 
                    "type": ["string", "null"]
                  }, 
                  "PostalCode": {
                    "description": "Postal/ZIP code. Required for AGCO; blank for others.", 
                    "type": ["string", "null"]
                  }, 
                  "StateProvince": {
                    "description": "State or province code. Required for AGCO; blank for others.", 
                    "type": ["string", "null"]
                  }
                }
              }
            }, 
            "required": ["ShipTo", "LineItems"]
          }, 
          "minItems": 1
        }
      }, 
      "required": [
        "InvoiceNumber", "InvoiceDate", "PONumber", "CreateDateTime", "Currency", 
        "InvoiceTotal", "Shipments"
      ]
    }
  }, 
  "definitions": {
    "BillToAddress": {
      "description": "Billing party. Required for Rehlko and Kohler. Sourced from the OrderEvent.", 
      "type": "object", 
      "additionalProperties": false, 
      "title": "BillTo Address", 
      "properties": {
        "AddressCode": {
          "description": "Division or department code sent by the customer on the original order. Kohler values: PNA1 (Plumbing), ENG1 (Engines), HSP1 (Hospitality), COR1 (Corporate).", 
          "type": ["string", "null"]
        }, 
        "Company": { "description": "Bill-to company name.", "type": ["string", "null"] }
      }
    }, 
    "LineItem": {
      "description": "A single invoiced line within a shipment. Current scope supports line item totals only; there is no mechanism for order fees, tax, or shipping costs.", 
      "type": "object", 
      "additionalProperties": false, 
      "title": "Line Item", 
      "properties": {
        "AdditionalProperties": {
          "description": "Customer-specific EDI qualifier fields attached to a line item. For PetSmart, these values must exactly match what was received on the original 850 purchase order.", 
          "type": "object", 
          "additionalProperties": false, 
          "title": "Line Item Additional Properties", 
          "properties": {
            "edi_productServiceIDQualifier_BP": {
              "description": "Buyer's part number / article number (BP qualifier). Required for PetSmart. Sourced from the OrderEvent AdditionalProperties.", 
              "type": ["string", "null"]
            }, 
            "edi_productServiceIDQualifier_UP": {
              "description": "UPC/EAN barcode (UP qualifier). Required for PetSmart. Sourced from the OrderEvent AdditionalProperties.", 
              "type": ["string", "null"]
            }
          }
        }, 
        "LineItemDescription": {
          "description": "Optional description for the line item (e.g., a fee label). Sourced from Slingshot.", 
          "type": ["string", "null"]
        }, 
        "OfferLineNumber": {
          "description": "Line sequence number from the OrderEvent. Required for all customers except PetSmart; blank for PetSmart.", 
          "type": ["string", "null"]
        }, 
        "OfferNumber": {
          "description": "Customer's part number from the original PO (OrderEvent). Must exactly match what was received on the 850 for PetSmart.", 
          "type": "string"
        }, 
        "Price": {
          "description": "Line total in dollars (QuantityShipped \u00d7 UnitPrice). Must be a positive decimal. Sourced from the OrderEvent.", 
          "type": "number", 
          "exclusiveMinimum": 0
        }, 
        "QuantityShipped": {
          "description": "Quantity invoiced. Must be a positive integer. Sourced from the OrderEvent.", 
          "type": "integer", 
          "minimum": 1
        }, 
        "UnitPrice": {
          "description": "Unit price in dollars. Must be a positive decimal. Sourced from the OrderEvent.", 
          "type": "number", 
          "exclusiveMinimum": 0
        }
      }, 
      "required": ["QuantityShipped", "UnitPrice", "OfferNumber", "Price"]
    }, 
    "LineItemAdditionalProperties": {
      "description": "Customer-specific EDI qualifier fields attached to a line item. For PetSmart, these values must exactly match what was received on the original 850 purchase order.", 
      "type": "object", 
      "additionalProperties": false, 
      "title": "Line Item Additional Properties", 
      "properties": {
        "edi_productServiceIDQualifier_BP": {
          "description": "Buyer's part number / article number (BP qualifier). Required for PetSmart. Sourced from the OrderEvent AdditionalProperties.", 
          "type": ["string", "null"]
        }, 
        "edi_productServiceIDQualifier_UP": {
          "description": "UPC/EAN barcode (UP qualifier). Required for PetSmart. Sourced from the OrderEvent AdditionalProperties.", 
          "type": ["string", "null"]
        }
      }
    }, 
    "ShipToAddress": {
      "description": "Destination ship-to address. Full address fields (Company, Address1, City, StateProvince, PostalCode, Country) are required for AGCO; null/blank for others. Sourced from the OrderEvent Shipment.", 
      "type": "object", 
      "additionalProperties": false, 
      "title": "ShipTo Address", 
      "properties": {
        "Address1": {
          "description": "Street address. Required for AGCO; blank for others.", 
          "type": ["string", "null"]
        }, 
        "AddressCode": {
          "description": "Location or site code from the ShipTo on the OrderEvent. PetSmart codes must be exactly 4 digits with leading zeros (e.g., '0012', not '12').", 
          "type": ["string", "null"]
        }, 
        "City": {
          "description": "City. Required for AGCO; blank for others.", 
          "type": ["string", "null"]
        }, 
        "Company": {
          "description": "Destination company name. Required for AGCO; blank for others.", 
          "type": ["string", "null"]
        }, 
        "Country": {
          "description": "ISO country code. Required for AGCO; blank for others.", 
          "type": ["string", "null"]
        }, 
        "PostalCode": {
          "description": "Postal/ZIP code. Required for AGCO; blank for others.", 
          "type": ["string", "null"]
        }, 
        "StateProvince": {
          "description": "State or province code. Required for AGCO; blank for others.", 
          "type": ["string", "null"]
        }
      }
    }, 
    "Shipment": {
      "description": "A single shipment within an invoice. For Kohler, each shipment corresponds to a distinct carrier tracking number. For AGCO and Rehlko there is effectively one shipment per invoice.", 
      "type": "object", 
      "additionalProperties": false, 
      "title": "Shipment", 
      "properties": {
        "LineItems": {
          "description": "One or more line items invoiced in this shipment.", 
          "type": "array", 
          "items": {
            "description": "A single invoiced line within a shipment. Current scope supports line item totals only; there is no mechanism for order fees, tax, or shipping costs.", 
            "type": "object", 
            "additionalProperties": false, 
            "title": "Line Item", 
            "properties": {
              "AdditionalProperties": {
                "description": "Customer-specific EDI qualifier fields attached to a line item. For PetSmart, these values must exactly match what was received on the original 850 purchase order.", 
                "type": "object", 
                "additionalProperties": false, 
                "title": "Line Item Additional Properties", 
                "properties": {
                  "edi_productServiceIDQualifier_BP": {
                    "description": "Buyer's part number / article number (BP qualifier). Required for PetSmart. Sourced from the OrderEvent AdditionalProperties.", 
                    "type": ["string", "null"]
                  }, 
                  "edi_productServiceIDQualifier_UP": {
                    "description": "UPC/EAN barcode (UP qualifier). Required for PetSmart. Sourced from the OrderEvent AdditionalProperties.", 
                    "type": ["string", "null"]
                  }
                }
              }, 
              "LineItemDescription": {
                "description": "Optional description for the line item (e.g., a fee label). Sourced from Slingshot.", 
                "type": ["string", "null"]
              }, 
              "OfferLineNumber": {
                "description": "Line sequence number from the OrderEvent. Required for all customers except PetSmart; blank for PetSmart.", 
                "type": ["string", "null"]
              }, 
              "OfferNumber": {
                "description": "Customer's part number from the original PO (OrderEvent). Must exactly match what was received on the 850 for PetSmart.", 
                "type": "string"
              }, 
              "Price": {
                "description": "Line total in dollars (QuantityShipped \u00d7 UnitPrice). Must be a positive decimal. Sourced from the OrderEvent.", 
                "type": "number", 
                "exclusiveMinimum": 0
              }, 
              "QuantityShipped": {
                "description": "Quantity invoiced. Must be a positive integer. Sourced from the OrderEvent.", 
                "type": "integer", 
                "minimum": 1
              }, 
              "UnitPrice": {
                "description": "Unit price in dollars. Must be a positive decimal. Sourced from the OrderEvent.", 
                "type": "number", 
                "exclusiveMinimum": 0
              }
            }, 
            "required": ["QuantityShipped", "UnitPrice", "OfferNumber", "Price"]
          }, 
          "minItems": 1
        }, 
        "MasterTrackingNumber": {
          "description": "Carrier tracking number for this shipment. Required for Kohler; null/blank for all other customers. Sourced from the OrderEvent. Used to match the invoice to a specific package.", 
          "type": ["string", "null"]
        }, 
        "PackingSlipNumber": {
          "description": "BOL or packing slip number. Required for AGCO and Rehlko. Null/blank for Kohler and PetSmart. Sourced from the OrderEvent.", 
          "type": ["string", "null"]
        }, 
        "ShipDateUtc": {
          "description": "Ship date for this shipment in YYYY-MM-DD format. Required for Kohler; null/blank for others. Sourced from the OrderEvent.", 
          "type": ["string", "null"], 
          "format": "date"
        }, 
        "ShipTo": {
          "description": "Destination ship-to address. Full address fields (Company, Address1, City, StateProvince, PostalCode, Country) are required for AGCO; null/blank for others. Sourced from the OrderEvent Shipment.", 
          "type": "object", 
          "additionalProperties": false, 
          "title": "ShipTo Address", 
          "properties": {
            "Address1": {
              "description": "Street address. Required for AGCO; blank for others.", 
              "type": ["string", "null"]
            }, 
            "AddressCode": {
              "description": "Location or site code from the ShipTo on the OrderEvent. PetSmart codes must be exactly 4 digits with leading zeros (e.g., '0012', not '12').", 
              "type": ["string", "null"]
            }, 
            "City": {
              "description": "City. Required for AGCO; blank for others.", 
              "type": ["string", "null"]
            }, 
            "Company": {
              "description": "Destination company name. Required for AGCO; blank for others.", 
              "type": ["string", "null"]
            }, 
            "Country": {
              "description": "ISO country code. Required for AGCO; blank for others.", 
              "type": ["string", "null"]
            }, 
            "PostalCode": {
              "description": "Postal/ZIP code. Required for AGCO; blank for others.", 
              "type": ["string", "null"]
            }, 
            "StateProvince": {
              "description": "State or province code. Required for AGCO; blank for others.", 
              "type": ["string", "null"]
            }
          }
        }
      }, 
      "required": ["ShipTo", "LineItems"]
    }
  }
}