.PHONY: help install install-dev test test-unit test-e2e lint format type-check clean build publish

help:
	@echo "Context Surfaces Python Client - Makefile"
	@echo ""
	@echo "Available targets:"
	@echo "  install       - Install package"
	@echo "  install-dev   - Install package with dev dependencies"
	@echo "  test          - Run all tests"
	@echo "  test-unit     - Run unit tests only"
	@echo "  test-e2e      - Run E2E tests (requires server)"
	@echo "  test-cov      - Run tests with coverage"
	@echo "  lint          - Run linting"
	@echo "  format        - Format code"
	@echo "  type-check    - Run type checking"
	@echo "  clean         - Clean build artifacts"
	@echo "  build         - Build package"
	@echo "  publish       - Publish to PyPI"

install:
	uv pip install -e .

install-dev:
	uv sync

test:
	pytest

test-unit:
	pytest -m "not e2e"

test-e2e:
	@echo "Running E2E tests (requires server at http://localhost:8080)"
	./scripts/run_e2e_tests.sh

test-cov:
	pytest --cov --cov-report=html --cov-report=term

lint:
	ruff check src tests examples

format:
	ruff format src tests examples

type-check:
	mypy src

clean:
	rm -rf build/
	rm -rf dist/
	rm -rf *.egg-info
	rm -rf .pytest_cache
	rm -rf .mypy_cache
	rm -rf .ruff_cache
	rm -rf htmlcov
	rm -rf .coverage
	find . -type d -name __pycache__ -exec rm -rf {} +
	find . -type f -name "*.pyc" -delete

build: clean
	uv build

publish: build
	uv publish

# Development shortcuts
dev: install-dev

check: lint type-check test

all: format lint type-check test
