.PHONY: up down demo test test-visible test-mobile shell submit verify check-link

up:            ## bring the whole stack up
	docker compose up --build -d && docker compose logs -f web

demo:          ## seed the deterministic acct-demo account (idempotent; run after `make up`)
	docker compose exec web python manage.py seed_demo

down:
	docker compose down -v

test-visible:  ## the supported-workflow tests you can see
	docker compose run --rm web python manage.py test tests api -v 2

test-mobile:   ## the mobile tests you can see (runs on the host, not in docker)
	@# mobile-tests resolves react, react-native and the babel helpers from the
	@# app's own tree, so its install alone is not enough. Installing both here
	@# because the failure otherwise is a module-resolution stack trace that says
	@# nothing about the missing step. npm install is a no-op once satisfied.
	cd mobile && npm install --silent
	cd mobile-tests && npm install --silent && npx jest --runInBand

test: test-visible
	@echo
	@echo "test-visible only covers the service. The statement screen has its"
	@echo "own tests: make test-mobile. Both are graded."

shell:
	docker compose run --rm web python manage.py shell

submit:        ## build the submission zip correctly
	@python3 tools/submit.py

verify:        ## check the zip the way the evaluator will
	@python3 tools/verify.py

check-link:    ## confirm your upload URL serves the archive anonymously
	@python3 tools/check_link.py "$(URL)"
