internal static SpatialAnalysisOperationBase DeserializeSpatialAnalysisOperationBase(JsonElement element)
        {
            if (element.TryGetProperty("@type", out JsonElement discriminator))
            {
                switch (discriminator.GetString())
                {
                case "#Microsoft.VideoAnalyzer.SpatialAnalysisCustomOperation": return(SpatialAnalysisCustomOperation.DeserializeSpatialAnalysisCustomOperation(element));

                case "#Microsoft.VideoAnalyzer.SpatialAnalysisPersonCountOperation": return(SpatialAnalysisPersonCountOperation.DeserializeSpatialAnalysisPersonCountOperation(element));

                case "#Microsoft.VideoAnalyzer.SpatialAnalysisPersonDistanceOperation": return(SpatialAnalysisPersonDistanceOperation.DeserializeSpatialAnalysisPersonDistanceOperation(element));

                case "#Microsoft.VideoAnalyzer.SpatialAnalysisPersonLineCrossingOperation": return(SpatialAnalysisPersonLineCrossingOperation.DeserializeSpatialAnalysisPersonLineCrossingOperation(element));

                case "#Microsoft.VideoAnalyzer.SpatialAnalysisPersonZoneCrossingOperation": return(SpatialAnalysisPersonZoneCrossingOperation.DeserializeSpatialAnalysisPersonZoneCrossingOperation(element));

                case "SpatialAnalysisTypedOperationBase": return(SpatialAnalysisTypedOperationBase.DeserializeSpatialAnalysisTypedOperationBase(element));
                }
            }
            string type = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("@type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
            }
            return(new SpatialAnalysisOperationBase(type));
        }
        internal static SpatialAnalysisTypedOperationBase DeserializeSpatialAnalysisTypedOperationBase(JsonElement element)
        {
            if (element.TryGetProperty("@type", out JsonElement discriminator))
            {
                switch (discriminator.GetString())
                {
                case "#Microsoft.VideoAnalyzer.SpatialAnalysisPersonCountOperation": return(SpatialAnalysisPersonCountOperation.DeserializeSpatialAnalysisPersonCountOperation(element));

                case "#Microsoft.VideoAnalyzer.SpatialAnalysisPersonDistanceOperation": return(SpatialAnalysisPersonDistanceOperation.DeserializeSpatialAnalysisPersonDistanceOperation(element));

                case "#Microsoft.VideoAnalyzer.SpatialAnalysisPersonLineCrossingOperation": return(SpatialAnalysisPersonLineCrossingOperation.DeserializeSpatialAnalysisPersonLineCrossingOperation(element));

                case "#Microsoft.VideoAnalyzer.SpatialAnalysisPersonZoneCrossingOperation": return(SpatialAnalysisPersonZoneCrossingOperation.DeserializeSpatialAnalysisPersonZoneCrossingOperation(element));
                }
            }
            Optional <string> debug = default;
            Optional <string> cameraConfiguration       = default;
            Optional <string> detectorNodeConfiguration = default;
            Optional <string> enableFaceMaskClassifier  = default;
            string            type = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("debug"))
                {
                    debug = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("cameraConfiguration"))
                {
                    cameraConfiguration = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("detectorNodeConfiguration"))
                {
                    detectorNodeConfiguration = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("enableFaceMaskClassifier"))
                {
                    enableFaceMaskClassifier = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("@type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
            }
            return(new SpatialAnalysisTypedOperationBase(type, debug.Value, cameraConfiguration.Value, detectorNodeConfiguration.Value, enableFaceMaskClassifier.Value));
        }