.PHONY: help deploy_qa_streamlit drop_qa_stremlit run_streamlit_locally fmt lint run_local_etl create_snowflake_tasks
.DEFAULT_GOAL := help

help:
	@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

deploy_streamlit_app: ## Deploy Streamlit app to PROD
	cd streamlit_app && poetry run snow streamlit deploy --replace --connection=sme_merch --schema=MY_DEV_SCHEMA

drop_streamlit_app: ## Drop Streamlit app and related stage in PROD
	poetry run snow streamlit drop sme_merch --connection=sme_merch --schema=MY_DEV_SCHEMA && \
	poetry run snow stage drop sme_merch_stage --connection=sme_merch --schema=MY_DEV_SCHEMA

run_streamlit_locally: ## Run Streamlit app locally
	poetry run streamlit run streamlit_app/main.py

run_etl_locally: ## Run ETL files using local session
	poetry run python main_pipeline.py

create_snowflake_tasks: ### Create Stored Procedure based flow of tasks
	poetry run python snowflake_tasks.py

fmt: ## Run code formatters
	poetry run ruff check --fix .
	poetry run ruff format .

lint: ## Run code linters
	poetry run mypy .
	poetry run ruff check .
	poetry run ruff format --check .
