/// <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, AutoScalingTrigger obj)
        {
            var kind = obj.Kind;

            if (kind.Equals(AutoScalingTriggerKind.AverageLoad))
            {
                AverageLoadScalingTriggerConverter.Serialize(writer, (AverageLoadScalingTrigger)obj);
            }
            else
            {
                throw new InvalidOperationException("Unknown kind.");
            }
        }
        /// <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 AutoScalingTrigger GetFromJsonProperties(JsonReader reader)
        {
            AutoScalingTrigger obj = null;
            var propName           = reader.ReadPropertyName();

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

            var propValue = reader.ReadValueAsString();

            if (propValue.Equals("AverageLoad", StringComparison.OrdinalIgnoreCase))
            {
                obj = AverageLoadScalingTriggerConverter.GetFromJsonProperties(reader);
            }
            else
            {
                throw new InvalidOperationException("Unknown kind.");
            }

            return(obj);
        }