/// <summary>
        /// Gets the object from Json properties.
        /// </summary>
        /// <param name="reader">The <see cref="T: Newtonsoft.Json.JsonReader" /> to read from.</param>
        /// <returns>The object Value.</returns>
        internal static PartitionInformation GetFromJsonProperties(JsonReader reader)
        {
            PartitionInformation obj;
            var propName = reader.ReadPropertyName();

            if (!propName.Equals("ServicePartitionKind", StringComparison.Ordinal))
            {
                throw new JsonReaderException($"Incorrect discriminator property name {propName}, Expected discriminator property name is ServicePartitionKind.");
            }

            var propValue = reader.ReadValueAsString();

            if (propValue.Equals("Int64Range", StringComparison.Ordinal))
            {
                obj = Int64RangePartitionInformationConverter.GetFromJsonProperties(reader);
            }
            else if (propValue.Equals("Named", StringComparison.Ordinal))
            {
                obj = NamedPartitionInformationConverter.GetFromJsonProperties(reader);
            }
            else if (propValue.Equals("Singleton", StringComparison.Ordinal))
            {
                obj = SingletonPartitionInformationConverter.GetFromJsonProperties(reader);
            }
            else
            {
                throw new InvalidOperationException("Unknown ServicePartitionKind.");
            }

            return(obj);
        }
        /// <summary>
        /// Serializes the object to JSON.
        /// </summary>
        /// <param name="writer">The <see cref="T: Newtonsoft.Json.JsonWriter" /> to write to.</param>
        /// <param name="obj">The object to serialize to JSON.</param>
        internal static void Serialize(JsonWriter writer, PartitionInformation obj)
        {
            var kind = obj.ServicePartitionKind;

            if (kind.Equals(ServicePartitionKind.Int64Range))
            {
                Int64RangePartitionInformationConverter.Serialize(writer, (Int64RangePartitionInformation)obj);
            }
            else if (kind.Equals(ServicePartitionKind.Named))
            {
                NamedPartitionInformationConverter.Serialize(writer, (NamedPartitionInformation)obj);
            }
            else if (kind.Equals(ServicePartitionKind.Singleton))
            {
                SingletonPartitionInformationConverter.Serialize(writer, (SingletonPartitionInformation)obj);
            }
            else
            {
                throw new InvalidOperationException("Unknown ServicePartitionKind.");
            }
        }