.PHONY: help build test lint fmt vet clean tidy ci compose-up compose-down

GO ?= go
GOLANGCI_LINT ?= golangci-lint
COMPOSE ?= podman-compose

help:
	@echo "Цели:"
	@echo "  make build           - сборка всех бинарников Go"
	@echo "  make test            - юнит-тесты"
	@echo "  make lint            - golangci-lint"
	@echo "  make fmt             - gofmt + goimports"
	@echo "  make vet             - go vet"
	@echo "  make tidy            - go mod tidy"
	@echo "  make ci              - все проверки CI локально"
	@echo "  make compose-up      - поднять локальный стек (PostgreSQL, MinIO, заглушки)"
	@echo "  make compose-down    - остановить локальный стек"
	@echo "  make clean           - удалить артефакты"

build:
	@mkdir -p bin
	$(GO) build -o bin/bj-server   ./cmd/bj-server
	$(GO) build -o bin/lk-emulator ./cmd/lk-emulator

test:
	$(GO) test ./... -race -count=1

lint:
	$(GOLANGCI_LINT) run ./...

fmt:
	$(GO) fmt ./...

vet:
	$(GO) vet ./...

tidy:
	$(GO) mod tidy

ci: tidy fmt vet lint test build

compose-up:
	$(COMPOSE) -f deploy/docker-compose/docker-compose.yml up -d

compose-down:
	$(COMPOSE) -f deploy/docker-compose/docker-compose.yml down

clean:
	rm -rf bin/ dist/ coverage.out coverage.html
