SPEC_SRC = ../sandbox_frontend/public/openapi.json
SPEC_DST = finradar_cli/data/openapi.json

.PHONY: sync-spec generate check-drift

sync-spec:
	cp $(SPEC_SRC) $(SPEC_DST)
	@python -c "import json;print('synced', json.load(open('$(SPEC_DST)'))['info']['version'])"

generate:
	python generate.py

check-drift: generate
	git diff --exit-code finradar_cli/_generated finradar_cli/data || \
	  (echo 'Generated artifacts out of date — run `make sync-spec` (if the spec moved) then `make generate`, and commit the result' && exit 1)
