.PHONY: build test lint generate clean help

# Build the library
build:
	go build ./...

# Run tests
test:
	go test -v ./...

# Run tests with coverage
test-coverage:
	go test -v -coverprofile=coverage.out ./...
	go tool cover -html=coverage.out -o coverage.html

# Run integration tests (requires live endpoint)
test-integration:
	go test -v ./... -run Integration

# Format code
fmt:
	go fmt ./...

# Run linter (requires golangci-lint)
lint:
	golangci-lint run

# Generate GraphQL client code
generate:
	go run github.com/Khan/genqlient@latest

# Clean build artifacts
clean:
	go clean -testcache
	rm -f coverage.out coverage.html

# Tidy dependencies
tidy:
	go mod tidy

# Run all checks (fmt, lint, test)
check: fmt lint test

# Show help
help:
	@echo "Available targets:"
	@echo "  build          - Build the library"
	@echo "  test           - Run all tests"
	@echo "  test-coverage  - Run tests with coverage report"
	@echo "  test-integration - Run integration tests only"
	@echo "  fmt            - Format Go code"
	@echo "  lint           - Run linter (requires golangci-lint)"
	@echo "  generate       - Generate GraphQL client code"
	@echo "  clean          - Clean build artifacts"
	@echo "  tidy           - Tidy dependencies"
	@echo "  check          - Run fmt, lint, and test"
	@echo "  help           - Show this help message"