
### buf ###

.PHONY: proto
proto: generate-proto format-proto lint-proto

.PHONY: generate-proto
generate-proto: install-gotag
	buf generate
	buf generate --template buf.gen.swagger-v1.yaml --path integration/v1
	buf generate --template buf.gen.swagger-openapi-v1beta1.yaml --path integration/openapi/v1beta1
	buf generate --template buf.gen.tag.yaml

.PHONY: format-proto
format-proto:
	buf format -w

.PHONY: lint-proto
lint-proto:
	buf lint

install-gotag:
	@if ! command -v protoc-gen-gotag &> /dev/null; then \
		go install github.com/srikrsna/protoc-gen-gotag@v1.0.2; \
	fi

doc: proto
	cd integration/openapi/v1beta1 && redocly build-docs services.swagger.json -o index.html
	cd integration/openapi/v1beta1 && python -m http.server 8000
