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

    def list(self, cluster_id):
        return self.client.request("GET", f"/backups/clusters/{cluster_id}")

    def get(self, backup_id):
        return self.client.request("GET", f"/backups/{backup_id}")

    def create(self, cluster_id, name=None):
        data = {}
        if name:
            data["name"] = name
        return self.client.request("POST", f"/backups/clusters/{cluster_id}/backup", json=data)

    def restore(self, backup_id, cluster_id):
        return self.client.request("POST", f"/backups/{backup_id}/restore", json={"clusterId": cluster_id})

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

    def get_stats(self):
        return self.client.request("GET", "/backups/stats/summary")
