internal LoginInformation(LoginRoutes routes, TokenStore tokenStore, bool?preserveUrlFragmentsForLogins, IList <string> allowedExternalRedirectUrls, CookieExpiration cookieExpiration, Nonce nonce)
 {
     Routes     = routes;
     TokenStore = tokenStore;
     PreserveUrlFragmentsForLogins = preserveUrlFragmentsForLogins;
     AllowedExternalRedirectUrls   = allowedExternalRedirectUrls;
     CookieExpiration = cookieExpiration;
     Nonce            = nonce;
 }
        internal static LoginInformation DeserializeLoginInformation(JsonElement element)
        {
            Optional <LoginRoutes>      routes     = default;
            Optional <TokenStore>       tokenStore = default;
            Optional <bool>             preserveUrlFragmentsForLogins = default;
            Optional <IList <string> >  allowedExternalRedirectUrls   = default;
            Optional <CookieExpiration> cookieExpiration = default;
            Optional <Nonce>            nonce            = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("routes"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    routes = LoginRoutes.DeserializeLoginRoutes(property.Value);
                    continue;
                }
                if (property.NameEquals("tokenStore"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    tokenStore = TokenStore.DeserializeTokenStore(property.Value);
                    continue;
                }
                if (property.NameEquals("preserveUrlFragmentsForLogins"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    preserveUrlFragmentsForLogins = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("allowedExternalRedirectUrls"))
                {
                    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());
                    }
                    allowedExternalRedirectUrls = array;
                    continue;
                }
                if (property.NameEquals("cookieExpiration"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    cookieExpiration = CookieExpiration.DeserializeCookieExpiration(property.Value);
                    continue;
                }
                if (property.NameEquals("nonce"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    nonce = Nonce.DeserializeNonce(property.Value);
                    continue;
                }
            }
            return(new LoginInformation(routes.Value, tokenStore.Value, Optional.ToNullable(preserveUrlFragmentsForLogins), Optional.ToList(allowedExternalRedirectUrls), cookieExpiration.Value, nonce.Value));
        }