#!/bin/bash
date=$(date +%Y-%m-%d)
# Standaardwaarde voor days
days=1
project_dir="chemba"

# Loop door alle argumenten
for arg in "$@"; do
    case "$arg" in
        --days=*)
            days="${arg#*=}"
            ;;
        --date=*)
            date="${arg#*=}"
            ;;
         --project_dir=*)
            project_dir="${arg#*=}"
            ;;
         --bbox=*)
                    bbox="${arg#*=}"
                    ;;
        *)
            echo "Onbekende optie: $arg"
            exit 1
            ;;
    esac
    shift
done

# Gebruik de variabele in je script
echo "Datum: $date"
echo "Aantal dagen: $days"
echo "Project directory: $project_dir"
echo "BBOX: $bbox"


# Activeer de virtuele omgeving
script_dir="$(dirname "$0")"
source "$script_dir/python_app/myenv/bin/activate"
echo  "$script_dir/python_app/planet_download.ipynb"
export DAYS=$days
export DATE=$date
export PROJECT_DIR=$project_dir
export BBOX=$bbox

# Hier kan je verdere stappen toevoegen, zoals het uitvoeren van je Python-script of Jupyter Notebook
jupyter nbconvert --execute --to script --stdout "$script_dir/python_app/planet_download.ipynb" #needs to be calling 00_download_8band_pu_optimized.py instead of the notebook directly

# Deactiveer de virtuele omgeving (optioneel)
deactivate
