PYTHON ?= python
APP ?= outage_api.main:app
HOST ?= 127.0.0.1
PORT ?= 8000
OPENAPI_OUT ?= build/openapi.json

.PHONY: install run test migrate seed openapi smoke clean

install:
	$(PYTHON) -m pip install -e ".[dev]"

run:
	$(PYTHON) -m uvicorn $(APP) --reload --host $(HOST) --port $(PORT)

test:
	$(PYTHON) -m pytest

migrate:
	$(PYTHON) -m alembic upgrade head

seed:
	$(PYTHON) -m outage_api.seed

openapi:
	$(PYTHON) scripts/export_openapi.py --output $(OPENAPI_OUT)

smoke:
	$(PYTHON) scripts/smoke_api.py --base-url http://$(HOST):$(PORT)

clean:
	rm -rf .pytest_cache .ruff_cache .mypy_cache build
	find . -type d -name __pycache__ -prune -exec rm -rf {} +
