internal static EntityRecognitionTasksItem DeserializeEntityRecognitionTasksItem(JsonElement element)
        {
            EntitiesResult    results            = default;
            DateTimeOffset    lastUpdateDateTime = default;
            Optional <string> name   = default;
            JobStatus         status = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("results"))
                {
                    results = EntitiesResult.DeserializeEntitiesResult(property.Value);
                    continue;
                }
                if (property.NameEquals("lastUpdateDateTime"))
                {
                    lastUpdateDateTime = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("status"))
                {
                    status = new JobStatus(property.Value.GetString());
                    continue;
                }
            }
            return(new EntityRecognitionTasksItem(lastUpdateDateTime, name.Value, status, results));
        }
        public async Task <Response <EntitiesResult> > EntitiesRecognitionGeneralAsync(MultiLanguageBatchInput input, string modelVersion = null, bool?showStats = null, CancellationToken cancellationToken = default)
        {
            if (input == null)
            {
                throw new ArgumentNullException(nameof(input));
            }

            using var message = CreateEntitiesRecognitionGeneralRequest(input, modelVersion, showStats);
            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);

            switch (message.Response.Status)
            {
            case 200:
            {
                EntitiesResult value = default;
                using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);

                if (document.RootElement.ValueKind == JsonValueKind.Null)
                {
                    value = null;
                }
                else
                {
                    value = EntitiesResult.DeserializeEntitiesResult(document.RootElement);
                }
                return(Response.FromValue(value, message.Response));
            }
        internal static EntityRecognitionTasksItem DeserializeEntityRecognitionTasksItem(JsonElement element)
        {
            Optional <EntitiesResult> results            = default;
            DateTimeOffset            lastUpdateDateTime = default;
            string    name   = default;
            JobStatus status = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("results"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    results = EntitiesResult.DeserializeEntitiesResult(property.Value);
                    continue;
                }
                if (property.NameEquals("lastUpdateDateTime"))
                {
                    lastUpdateDateTime = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("status"))
                {
                    status = new JobStatus(property.Value.GetString());
                    continue;
                }
            }
            return(new EntityRecognitionTasksItem(lastUpdateDateTime, name, status, results.Value));
        }