internal RestorePointGroupData(ResourceIdentifier id, string name, ResourceType type, IDictionary <string, string> tags, AzureLocation location, RestorePointCollectionSourceProperties source, string provisioningState, string restorePointCollectionId, IReadOnlyList <RestorePointData> restorePoints) : base(id, name, type, tags, location)
 {
     Source                   = source;
     ProvisioningState        = provisioningState;
     RestorePointCollectionId = restorePointCollectionId;
     RestorePoints            = restorePoints;
 }
        private RestorePointCollection CreateRpc(string sourceVMId, string rpcName,
                                                 string rgName, string location, Dictionary <string, string> tags)
        {
            //Models.SubResource sourceVM = new Models.SubResource(id: sourceVMId);
            RestorePointCollectionSourceProperties rpcSourceProperties = new RestorePointCollectionSourceProperties(location: location, id: sourceVMId);
            var inputRpc = new RestorePointCollection(location, source: rpcSourceProperties, name: rpcName, tags: tags);
            RestorePointCollection restorePointCollection =
                m_CrpClient.RestorePointCollections.CreateOrUpdate(rgName, rpcName,
                                                                   inputRpc);

            return(restorePointCollection);
        }
        internal static RestorePointGroupData DeserializeRestorePointGroupData(JsonElement element)
        {
            IDictionary <string, string> tags = default;
            Location           location       = default;
            ResourceIdentifier id             = default;
            string             name           = default;
            ResourceType       type           = default;
            Optional <RestorePointCollectionSourceProperties> source = default;
            Optional <string> provisioningState        = default;
            Optional <string> restorePointCollectionId = default;
            Optional <IReadOnlyList <RestorePointData> > restorePoints = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("tags"))
                {
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        dictionary.Add(property0.Name, property0.Value.GetString());
                    }
                    tags = dictionary;
                    continue;
                }
                if (property.NameEquals("location"))
                {
                    location = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("source"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            source = RestorePointCollectionSourceProperties.DeserializeRestorePointCollectionSourceProperties(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            provisioningState = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("restorePointCollectionId"))
                        {
                            restorePointCollectionId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("restorePoints"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <RestorePointData> array = new List <RestorePointData>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(RestorePointData.DeserializeRestorePointData(item));
                            }
                            restorePoints = array;
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new RestorePointGroupData(id, name, type, tags, location, source.Value, provisioningState.Value, restorePointCollectionId.Value, Optional.ToList(restorePoints)));
        }