PYTHON ?= .venv/bin/python
PIP ?= .venv/bin/pip
SERVICE ?= importarr.service
LIVE_URL ?= http://127.0.0.1:8095

.PHONY: test install-systemd install-from-repo upgrade-local repo-upgrade verify-live

test:
	$(PYTHON) -m pytest

install-systemd:
	sudo -n sh deploy/systemd-install.sh

install-from-repo:
	sudo -n /opt/importarr/venv/bin/pip install --upgrade /srv/opencode-workspace/importarr

upgrade-local:
	sudo -n /opt/importarr/venv/bin/pip install --upgrade /srv/opencode-workspace/importarr
	sudo -n systemctl restart $(SERVICE)

repo-upgrade:
	sudo -n sh /opt/importarr/repo-upgrade.sh

verify-live:
	curl -fsS $(LIVE_URL)/health
	curl -fsS $(LIVE_URL)/api/status
	curl -fsS $(LIVE_URL)/api/preview
