internal static CognitiveServicesAccount DeserializeCognitiveServicesAccount(JsonElement element)
        {
            if (element.TryGetProperty("@odata.type", out JsonElement discriminator))
            {
                switch (discriminator.GetString())
                {
                case "#Microsoft.Azure.Search.CognitiveServicesByKey": return(CognitiveServicesAccountKey.DeserializeCognitiveServicesAccountKey(element));

                case "#Microsoft.Azure.Search.DefaultCognitiveServices": return(DefaultCognitiveServicesAccount.DeserializeDefaultCognitiveServicesAccount(element));
                }
            }
            CognitiveServicesAccount result = new CognitiveServicesAccount();

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("@odata.type"))
                {
                    result.ODataType = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("description"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    result.Description = property.Value.GetString();
                    continue;
                }
            }
            return(result);
        }
        internal static CognitiveServicesAccountKey DeserializeCognitiveServicesAccountKey(JsonElement element)
        {
            CognitiveServicesAccountKey result = new CognitiveServicesAccountKey();

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("key"))
                {
                    result.Key = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("@odata.type"))
                {
                    result.ODataType = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("description"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    result.Description = property.Value.GetString();
                    continue;
                }
            }
            return(result);
        }