# notification-service tasks (https://github.com/casey/just)

binary := ".build/release/NotificationService"

# default: show available recipes
default:
    @just --list

# regenerate the embedded app icon from bell-logo.avif, then build
icon: build
    ./Scripts/gen_icon.sh bell-logo.avif
    swift build -c release

# build the release binary
build:
    swift build -c release

# run the service in the foreground
run: build
    {{binary}} run

# install as a per-user LaunchAgent (starts at login)
install: build
    {{binary}} install

# remove the LaunchAgent and binary
uninstall: build
    {{binary}} uninstall

# pop a test notification window (service must be running: `just install` or `just run`)
test:
    curl -s -X POST http://127.0.0.1:11270/api/v1/show \
      -H 'Content-Type: application/json' \
      -d '{"title":"Hello","content":"World"}'

# pop a custom notification: just show "My Title" "My body text"
show title="Hello" content="World":
    curl -s -X POST http://127.0.0.1:11270/api/v1/show \
      -H 'Content-Type: application/json' \
      -d '{"title":"{{title}}","content":"{{content}}"}'

# clean build artifacts
clean:
    swift package clean

# show the binary's help text
help: build
    @{{binary}} help 2>/dev/null || swift run NotificationService help
