#!/bin/bash
UNITY_TARGET="$1"

TARGET=$(echo "$UNITY_TARGET" | awk '{print tolower($0)}')
BUILD_ARG=""
case $TARGET in
    "windows")
        UNITY_TARGET=Win64
        BUILD_ARG=-buildWindows64Player
        ;;
    "windows32bit")
        UNITY_TARGET=Win
        BUILD_ARG=-buildWindowsPlayer
        ;;
    "mac")
        UNITY_TARGET=OSXUniversal
        BUILD_ARG=-buildOSXUniversalPlayer
        ;;
    "ios")
        UNITY_TARGET=iOS
        ;;
    "linux")
        UNITY_TARGET=Linux64
        BUILD_ARG=-buildLinux64Player
        ;;
    "android")
        UNITY_TARGET=Android
        ;;
    "webgl")
        UNITY_TARGET=WebGL
        ;;
    *)
        echo "Invalid target. Valid options are: Windows, Windows32bit, Mac, iOS, Linux, Android, WebGL"
        ;;
esac

echo "buildTarget=$UNITY_TARGET" >> "$GITHUB_OUTPUT"
echo "buildArg=$BUILD_ARG" >> "$GITHUB_OUTPUT"
