internal InstanceHit(IReadOnlyList <object> timeSeriesId, string name, string typeId, IReadOnlyList <string> hierarchyIds, InstanceHitHighlights highlights)
 {
     TimeSeriesId = timeSeriesId;
     Name         = name;
     TypeId       = typeId;
     HierarchyIds = hierarchyIds;
     Highlights   = highlights;
 }
        internal static InstanceHit DeserializeInstanceHit(JsonElement element)
        {
            Optional <IReadOnlyList <object> > timeSeriesId = default;
            Optional <string> name   = default;
            Optional <string> typeId = default;
            Optional <IReadOnlyList <string> > hierarchyIds = default;
            Optional <InstanceHitHighlights>   highlights   = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("timeSeriesId"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <object> array = new List <object>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(item.GetObject());
                    }
                    timeSeriesId = array;
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("typeId"))
                {
                    typeId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("hierarchyIds"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <string> array = new List <string>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(item.GetString());
                    }
                    hierarchyIds = array;
                    continue;
                }
                if (property.NameEquals("highlights"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    highlights = InstanceHitHighlights.DeserializeInstanceHitHighlights(property.Value);
                    continue;
                }
            }
            return(new InstanceHit(Optional.ToList(timeSeriesId), name.Value, typeId.Value, Optional.ToList(hierarchyIds), highlights.Value));
        }