.PHONY: test test-all test-unit test-integration lint build

# Default: Run unit tests only (fast, no Chrome needed)
test: test-unit

# Run unit tests only (CI-safe, no Chrome)
test-unit:
	@echo "🧪 Running unit tests..."
	go test -v -race -coverprofile=coverage.txt -covermode=atomic ./...

# Run ALL tests including PDF/Chrome integration tests
test-all:
	@echo "🧪 Running ALL tests (including integration tests)..."
	go test -v -race -tags=integration -coverprofile=coverage.txt -covermode=atomic ./...

# Run integration tests only
test-integration:
	@echo "🧪 Running integration tests only..."
	go test -v -race -tags=integration ./internal/handlers -run PDF

# Run linter
lint:
	@echo "🔍 Running golangci-lint..."
	golangci-lint run

# Build binary
build:
	@echo "🔨 Building..."
	go build -v -o cv-server .

# Run all checks (lint + unit tests)
check: lint test-unit
	@echo "✅ All checks passed!"

# Run everything (lint + all tests + build)
all: lint test-all build
	@echo "✅ Everything passed!"
