internal static SentenceSentiment DeserializeSentenceSentiment(JsonElement element)
        {
            string text = default;
            SentenceSentimentValue           sentiment        = default;
            SentimentConfidenceScorePerLabel confidenceScores = default;
            int offset = default;
            int length = default;
            Optional <IReadOnlyList <SentenceAspect> >  aspects  = default;
            Optional <IReadOnlyList <SentenceOpinion> > opinions = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("text"))
                {
                    text = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("sentiment"))
                {
                    sentiment = property.Value.GetString().ToSentenceSentimentValue();
                    continue;
                }
                if (property.NameEquals("confidenceScores"))
                {
                    confidenceScores = SentimentConfidenceScorePerLabel.DeserializeSentimentConfidenceScorePerLabel(property.Value);
                    continue;
                }
                if (property.NameEquals("offset"))
                {
                    offset = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("length"))
                {
                    length = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("aspects"))
                {
                    List <SentenceAspect> array = new List <SentenceAspect>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(SentenceAspect.DeserializeSentenceAspect(item));
                    }
                    aspects = array;
                    continue;
                }
                if (property.NameEquals("opinions"))
                {
                    List <SentenceOpinion> array = new List <SentenceOpinion>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(SentenceOpinion.DeserializeSentenceOpinion(item));
                    }
                    opinions = array;
                    continue;
                }
            }
            return(new SentenceSentiment(text, sentiment, confidenceScores, offset, length, Optional.ToList(aspects), Optional.ToList(opinions)));
        }
        internal static DocumentSentiment DeserializeDocumentSentiment(JsonElement element)
        {
            string id = default;
            DocumentSentimentValue                        sentiment        = default;
            Optional <TextDocumentStatistics>             statistics       = default;
            SentimentConfidenceScorePerLabel              confidenceScores = default;
            IReadOnlyList <SentenceSentiment>             sentences        = default;
            IReadOnlyList <TextAnalyticsWarning_internal> warnings         = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("sentiment"))
                {
                    sentiment = property.Value.GetString().ToDocumentSentimentValue();
                    continue;
                }
                if (property.NameEquals("statistics"))
                {
                    statistics = TextDocumentStatistics.DeserializeTextDocumentStatistics(property.Value);
                    continue;
                }
                if (property.NameEquals("confidenceScores"))
                {
                    confidenceScores = SentimentConfidenceScorePerLabel.DeserializeSentimentConfidenceScorePerLabel(property.Value);
                    continue;
                }
                if (property.NameEquals("sentences"))
                {
                    List <SentenceSentiment> array = new List <SentenceSentiment>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(SentenceSentiment.DeserializeSentenceSentiment(item));
                    }
                    sentences = array;
                    continue;
                }
                if (property.NameEquals("warnings"))
                {
                    List <TextAnalyticsWarning_internal> array = new List <TextAnalyticsWarning_internal>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(TextAnalyticsWarning_internal.DeserializeTextAnalyticsWarning_internal(item));
                    }
                    warnings = array;
                    continue;
                }
            }
            return(new DocumentSentiment(id, sentiment, Optional.ToNullable(statistics), confidenceScores, sentences, warnings));
        }