help:
	@echo "Usage: make <target>"
	@echo "Targets:"
	@echo "  run         Run the application"
	@echo "  local       Install in editable mode for development"
	@echo "  global      Build and install system-wide to /usr/local/bin"
	@echo "  bump        Bump patch version (default)"
	@echo "  TYPE=MINOR make bump        Bump minor version"
	@echo "  TYPE=MAJOR make bump        Bump major version"
	@echo "  clean       Remove build artifacts"
	@echo "  uninstall   Remove global installation"
	@echo "  publish [PROD=TRUE]     Publish to PyPI"


run:
	@uv run tm sw

local:
	@echo "Installing time-manager (local dev)..."
	@uv pip install -e .
	@echo "Done."

global: build
	@echo "Installing time-manager system-wide..."
	@uv tool install time-manager

bump:
	@./scripts/bump.sh

build: bump
	@echo "Building standalone executable..."
	@uv run pyinstaller --onefile --name time-manager src/app.py --collect-all textual --hidden-import=tui --hidden-import=tui.stopwatch --hidden-import=tui.countdown --add-data "src/tui/theme.tcss:tui"
	@echo "Building wheel..."
	@uv build
	@echo "Done. Executable is at dist/time-manager and wheel is at dist/time_manager-<version>-py3-none-any.whl"

clean:
	@rm -rf build dist *.spec __pycache__
	@echo "Cleaned build artifacts."

uninstall:
	@echo "Uninstalling time-manager..."
	-@uv tool uninstall time-manager
	@echo "Done."

publish:
	@echo "Publishing to PyPI..."
	@PROD="$(PROD)" ./scripts/publish.sh
	@echo "Done. Published to PyPI."

.PHONY: local global build bump clean uninstall publish