.PHONY: check estate-check validate specimens exchange authority catalog-example policy-example runtime runtime-multidomain topology lens security reconcile working-set

check estate-check:
	python3 tools/check_all.py

validate:
	python3 tools/validate_fiam.py

specimens:
	python3 tools/validate_fiam.py $$(find specimens -name '*.yaml' | sort)

authority:
	python3 tools/validate_authority_policy.py policies/SNAPSHOT-AUTHORITY-v0.2.yaml

exchange:
	python tools/catalog_exchange.py convert real-world/catalog-exchange/runtime-2026-09-01.yaml -o /tmp/fiam-runtime.ndjson --input-format yaml --format ndjson

catalog-example:
	rm -f /tmp/fiam-estate.sqlite
	python tools/catalog_index.py ingest-exchange /tmp/fiam-estate.sqlite real-world/catalog-exchange/declared-2026-09-01.yaml
	python tools/catalog_index.py ingest-exchange /tmp/fiam-estate.sqlite real-world/catalog-exchange/runtime-2026-09-01.yaml --authority-policy policies/SNAPSHOT-AUTHORITY-v0.2.yaml
	python tools/catalog_index.py ingest-exchange /tmp/fiam-estate.sqlite real-world/catalog-exchange/runtime-2026-09-08.yaml --authority-policy policies/SNAPSHOT-AUTHORITY-v0.2.yaml
	python tools/catalog_index.py ingest-exchange /tmp/fiam-estate.sqlite real-world/catalog-exchange/runtime-2026-09-09.yaml --authority-policy policies/SNAPSHOT-AUTHORITY-v0.2.yaml
	python tools/architecture_changes_lens.py /tmp/fiam-estate.sqlite --population prod-cluster-a --since 2026-09-07T00:00:00Z --until 2026-09-09T23:59:59Z -o /tmp/fiam-changes.yaml

policy-example: catalog-example
	python tools/architecture_policy_lens.py /tmp/fiam-estate.sqlite --population prod-cluster-a --since 2026-09-07T00:00:00Z --until 2026-09-09T23:59:59Z --policy policies/ARCHITECTURE-GOVERNANCE-v0.2.yaml -o /tmp/fiam-policy.yaml

runtime:
	python tools/otel_to_fiam.py real-world/otel/petstore-get-pet-http2.otlp.json --base real-world/openapi/petstore-identity-excerpt.fiam.yaml -o real-world/composite/petstore-openapi-plus-otel.fiam.yaml

runtime-multidomain:
	python tools/otel_to_fiam.py real-world/otel/multidomain-runtime.otlp.json -o real-world/otel/multidomain-runtime.fiam.yaml

topology: runtime-multidomain
	python tools/runtime_topology_lens.py real-world/otel/multidomain-runtime.fiam.yaml -o real-world/otel/multidomain-runtime.topology.yaml --markdown real-world/otel/multidomain-runtime.topology.md

lens:
	python tools/declared_observed_lens.py real-world/composite/security-api-declared-plus-observed.fiam.yaml -o real-world/composite/security-api-declared-plus-observed.lens.yaml --markdown real-world/composite/security-api-declared-plus-observed.lens.md

security:
	python tools/openapi_to_fiam.py real-world/openapi/estate-hardening/security-api.yaml -o real-world/openapi/estate-hardening/security-api.fiam.yaml
	python tools/security_coverage_lens.py real-world/openapi/estate-hardening/security-api.fiam.yaml -o real-world/openapi/estate-hardening/security-api.security-coverage.yaml

working-set:
	python tools/working_set_view.py real-world/composite/gateway-rpc.fiam.yaml -o real-world/composite/gateway-rpc.working-set.yaml

reconcile:
	python tools/otel_to_fiam.py real-world/otel/grpc-runtime.otlp.json --base specimens/regression/04-grpc-bidirectional-stream.yaml -o real-world/composite/grpc-declared-plus-runtime.fiam.yaml
	python tools/otel_to_fiam.py real-world/otel/kafka-runtime.otlp.json --base specimens/regression/06-kafka-topic.yaml -o real-world/composite/kafka-declared-plus-runtime.fiam.yaml
	python tools/otel_to_fiam.py real-world/otel/postgres-runtime.otlp.json --base specimens/regression/03-shared-postgresql-table.yaml -o real-world/composite/postgres-declared-plus-runtime.fiam.yaml
