.PHONY: install dev test lint run deploy docker clean mcp

# ── Setup ─────────────────────────────────────────────────────────
install:
	pip install -e .

dev:
	pip install -e ".[dev]"

# ── Development ───────────────────────────────────────────────────
run:
	uvicorn app:app --reload --host 0.0.0.0 --port 8000

test:
	pytest tests/ -v --cov=x402_fastapi_kit

lint:
	ruff check x402_fastapi_kit/ tests/ examples/
	ruff check --fix x402_fastapi_kit/ tests/ examples/

# ── Deployment ────────────────────────────────────────────────────
deploy:
	@echo "Deploying to Railway..."
	@cp deploy/railway.toml .
	@cp deploy/Procfile .
	railway up
	@echo "✓ Deployed. Check your Railway dashboard."

docker-build:
	docker build -t x402-api .

docker-run:
	docker run -p 8000:8000 --env-file .env x402-api

# ── MCP ───────────────────────────────────────────────────────────
mcp:
	@echo "Generating MCP config..."
	python -c "from app import app; from x402_fastapi_kit.mcp import MCPWrapper; from x402_fastapi_kit.config import X402Settings; MCPWrapper(app, X402Settings()).write_config()"
	@echo "✓ mcp.json generated"

# ── Cleanup ───────────────────────────────────────────────────────
clean:
	find . -type d -name __pycache__ -exec rm -rf {} +
	find . -type d -name .pytest_cache -exec rm -rf {} +
	rm -rf .ruff_cache .mypy_cache .coverage htmlcov dist build *.egg-info
