/* -*- Mode: Vala; indent-tabs-mode: nil; tab-width: 2 -*-
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 * SPDX-FileCopyrightText: Michael Terry
 */

using GLib;

public abstract class DejaDup.ToolPlugin : Object
{
  public string name {get; protected set;}
  public abstract string get_version() throws Error;
  public virtual string[] get_dependencies() {return {};} // list of what-provides hints
  public virtual bool needs_dependencies() {return true;}
  public abstract DejaDup.ToolJob create_job() throws Error;
  public abstract bool supports_backend(Backend.Kind kind, out string explanation);
  public bool supports_mount() {
    // For testing reasons, allow overriding the FUSE browser for the old in-app
    // experience. And it allows folks to do so too, if they liked it better.
    // Only really needed to test the flow for Restic in the flatpak-on-Ubuntu use case.
    var env_str = Environment.get_variable("DEJA_DUP_RESTORE_IN_APP");
    var overriden = (env_str != null && int.parse(env_str) > 0);
    return !overriden && _supports_mount();
  }
  protected virtual bool _supports_mount() {return false;}
}
