.PHONY: help build test run clean docker-build docker-run fmt clippy check

help:
	@echo "Extension Registry Service - Make targets"
	@echo ""
	@echo "  build         Build release binary"
	@echo "  build-dev     Build debug binary"
	@echo "  test          Run tests"
	@echo "  run           Run service locally"
	@echo "  clean         Clean build artifacts"
	@echo "  docker-build  Build Docker image"
	@echo "  docker-run    Run Docker container"
	@echo "  fmt           Format code"
	@echo "  clippy        Run clippy linter"
	@echo "  check         Check code without building"
	@echo ""

build:
	cargo build --release

build-dev:
	cargo build

test:
	cargo test

run:
	cargo run -- --config config.toml --port 8082

clean:
	cargo clean
	rm -f config.toml

docker-build:
	docker build -t extension-registry:latest .

docker-run:
	docker-compose up -d

docker-stop:
	docker-compose down

fmt:
	cargo fmt

clippy:
	cargo clippy -- -D warnings

check:
	cargo check

audit:
	cargo audit

install-deps:
	cargo install cargo-audit

config:
	@if [ ! -f config.toml ]; then \
		cp config.example.toml config.toml; \
		echo "Created config.toml from example"; \
		echo "Please edit config.toml with your settings"; \
	else \
		echo "config.toml already exists"; \
	fi

all: fmt clippy test build
