class Notifications:
    def __init__(self, client):
        self.client = client

    def list(self, limit=50, unread_only=False):
        params = {"limit": limit}
        if unread_only:
            params["unreadOnly"] = unread_only
        return self.client.request("GET", "/notifications", params=params)

    def mark_read(self, notification_id):
        return self.client.request("PATCH", f"/notifications/{notification_id}/read")

    def mark_all_read(self):
        return self.client.request("PATCH", "/notifications/read-all")

    def delete(self, notification_id):
        return self.client.request("DELETE", f"/notifications/{notification_id}")

    def get_preferences(self):
        return self.client.request("GET", "/notifications/preferences")

    def update_preferences(self, preferences):
        return self.client.request("PUT", "/notifications/preferences", json=preferences)
