# Make all
all: 
	$(info Use make with the following arguments to controll this Project)
	$(info - init	=> Initializes the whole Project => Attention can overwrite data)
	$(info - up		=> Spinns the Project up)
	$(info - start	=> Starts this Project "Only works if data already existed")
	$(info - stop	=> Stops this Project "Only works if started or spun up") 
	$(info - clean	=> Clean this Project => Attention this deletes data)

# Start everything
init: db-init api-init ui-init

# Up everything
up: db-up api-up ui-up

# Start everything
start: db-start api-start ui-start

# Stop everything
stop: ui-stop api-stop db-stop

# Clean everything
clean: 
	chmod +x ./src/clean-data.sh
	./src/clean-data.sh

# Setup Database
db-init: config

db-up:
	docker-compose -f src/docker-compose.yml up ngx_mgmt_db -d
db-start:
	docker-compose -f src/docker-compose.yml start ngx_mgmt_db
db-stop:
	docker-compose -f src/docker-compose.yml stop ngx_mgmt_db

# Setup API
api: api-start

api-init:
	cd src/api; go build -o ../../bin/engine_x_mgmt
api-start:
	./bin/engine_x_mgmt &
api-stop:
	
# Setup UI
ui: ui-start

ui-start:

ui-stop:

# Regenerate configs
config: config-regenerate 

config-regenerate:
	python config/template.py