#!/usr/bin/env bash
set -euo pipefail

source ./scripts/Unix/starter.sh

# Database backup
log_step "Starting database backup process..."
if ! docker compose exec app uv run manage.py dbbackup; then
  log_error "Database backup failed"
  exit 1
fi
log_success "Database backup created under ./dbbackup"

# Media backup
log_step "Starting media backup process..."
if ! docker compose exec app uv run manage.py mediabackup; then
  log_error "Media backup failed"
  exit 1
fi
log_success "Media backup created under ./dbbackup"

echo
log_result "Backup completed successfully!"
