#!/bin/bash

backupAppSchedule()
{
    local app_name="$1"

    isHeader "Scheduling Backup for $app_name"

    if [[ "$CFG_REQUIREMENT_WEBUI" == "true" ]]; then
        local backup_command="libreportal backup app create $app_name"
        createTaskFile "$backup_command" "backup" "$app_name"
        if [[ $? -eq 0 ]]; then
            isSuccessful "Backup task queued — task processor will pick it up"
        else
            isError "Failed to create backup task — falling back to direct execution"
            backupAppStart "$app_name"
        fi
    else
        backupAppStart "$app_name"
    fi
}
