#!/bin/sh

PLZ=$1
PLZ=${PLZ:=68766}

STATE=$(curl -s -X GET -H "accept":"application/json" \
        https://api.stromgedacht.de/v1/now?zip=$PLZ | jq -rc .state)

case $STATE in
    -1) echo "superGreen"
    ;;
    1) echo "Green"
    ;;
    3) echo "Green"
    ;;
    4) echo "Green"
    ;;
    *) echo "Unkown state code: $STATE"
    ;;
esac


