internal static PushToken DeserializePushToken(XElement element)
        {
            DateTimeOffset? creationTime = default;
            PushTokenDevice?device       = default;
            string          referer      = default;
            PushTokenStatus?status       = default;
            string          token        = default;
            DateTimeOffset? updateTime   = default;
            string          userAgent    = default;

            if (element.Element("creationTime") is XElement creationTimeElement)
            {
                creationTime = creationTimeElement.GetDateTimeOffsetValue("O");
            }
            if (element.Element("device") is XElement deviceElement)
            {
                device = new PushTokenDevice(deviceElement.Value);
            }
            if (element.Element("referer") is XElement refererElement)
            {
                referer = (string)refererElement;
            }
            if (element.Element("status") is XElement statusElement)
            {
                status = new PushTokenStatus(statusElement.Value);
            }
            if (element.Element("token") is XElement tokenElement)
            {
                token = (string)tokenElement;
            }
            if (element.Element("updateTime") is XElement updateTimeElement)
            {
                updateTime = updateTimeElement.GetDateTimeOffsetValue("O");
            }
            if (element.Element("userAgent") is XElement userAgentElement)
            {
                userAgent = (string)userAgentElement;
            }
            return(new PushToken(creationTime, device, referer, status, token, updateTime, userAgent));
        }
        internal static PushToken DeserializePushToken(JsonElement element)
        {
            Optional <DateTimeOffset>  creationTime = default;
            Optional <PushTokenDevice> device       = default;
            Optional <string>          referer      = default;
            Optional <PushTokenStatus> status       = default;
            Optional <string>          token        = default;
            Optional <DateTimeOffset>  updateTime   = default;
            Optional <string>          userAgent    = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("creationTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    creationTime = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("device"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    device = new PushTokenDevice(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("referer"))
                {
                    referer = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("status"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    status = new PushTokenStatus(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("token"))
                {
                    token = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("updateTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    updateTime = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("userAgent"))
                {
                    userAgent = property.Value.GetString();
                    continue;
                }
            }
            return(new PushToken(Optional.ToNullable(creationTime), Optional.ToNullable(device), referer.Value, Optional.ToNullable(status), token.Value, Optional.ToNullable(updateTime), userAgent.Value));
        }