<script>
import {authenticatedRequest} from "@/components/session/authenticatedRequest.vue";
import {handleEconomicError} from "@/components/request/HandleEconomicError.vue";
import { API_keys } from "@/components/session/token/superUser/modules/reCAPTCHA/ApiKeys.vue";
import { Config } from "@/components/session/token/superUser/modules/Backups/Config.vue";

/**
 * The Backups object
 */
export const Backups = {
  meta: {
    title: "Backups",
    icon: "fas fa-database",
    description: "Backup af data",
    endpoint: "/modules/backup/backups",
    config_endpoint: "/configuration/backup",
    labels: {
      single: "backup",
      multiple: "backups"
    }
  },
  config: Config,
  createBackup: async (name = null, description = null) => {
    return authenticatedRequest(
        Backups.meta.endpoint,
        "POST",
        {
          name: name,
          description: description
        }
    )
  },
  listBackups: async () => {
    return authenticatedRequest(
        Backups.meta.endpoint,
        "GET"
    )
  },
};

</script>