APP_NAME=watermill-template

include .env

export $(shell sed 's/=.*//' .env)

run:
	@echo "🚀 Running $(APP_NAME)..."
	go run cmd/main.go

build:
	go build -o bin/$(APP_NAME) cmd/main.go

tidy:
	go mod tidy

create-tables:
	@if [ -z "$(topic)" ]; then \
		echo "❌ Usage: make create-table topic=<topic_name>"; \
	else \
		echo "🧱 Creating Watermill table for topic: $(topic)"; \
		go run cmd/main.go create-table $(topic); \
	fi

clean:
	rm -rf bin
