COMPOSE ?= docker compose

.PHONY: i18n-extract-en i18n-extract-de i18n-compile i18n-update-en i18n-update-de backup-create backup-verify release-validate

i18n-extract-en:
	$(COMPOSE) exec -T web django-admin makemessages -l en

i18n-extract-de:
	$(COMPOSE) exec -T web django-admin makemessages -l de

i18n-compile:
	$(COMPOSE) exec -T web django-admin compilemessages

i18n-update-en: i18n-extract-en i18n-compile

i18n-update-de: i18n-extract-de i18n-compile

backup-create:
	./scripts/backup_create.sh

backup-verify:
	@if [ -z "$(BACKUP_DIR)" ]; then echo "Usage: make backup-verify BACKUP_DIR=backups/backup_YYYYmmdd_HHMMSS"; exit 1; fi
	./scripts/backup_verify.sh "$(BACKUP_DIR)"

release-validate:
	$(COMPOSE) exec -T web python manage.py check
	$(COMPOSE) exec -T web python manage.py test workflows.tests -v 2
	$(COMPOSE) exec -T web django-admin compilemessages
	$(COMPOSE) exec -T web python manage.py collectstatic --noinput
	$(COMPOSE) exec -T web python manage.py verify_latest_backup --create-if-missing
	$(COMPOSE) exec -T web python manage.py run_staging_e2e_check --cleanup --email-check none --skip-nextcloud
