#!/bin/sh
# Load all stock assets into the server.
#
# Usage: ./stock/load.sh [--force|-f]
#
# Options:
#   --force, -f   Update existing assets instead of failing with 409 Conflict

# Get script directory
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"

# Parse arguments
FORCE_FLAG=""
for arg in "$@"; do
    case "$arg" in
        --force|-f)
            FORCE_FLAG="--force"
            ;;
    esac
done

(cd "$SCRIPT_DIR/avatar" && ./upload-stockavatars.sh $FORCE_FLAG)
(cd "$SCRIPT_DIR/props" && ./upload-stockprops.sh $FORCE_FLAG)

# Create stock avatar from uploaded props and set as default
(cd "$SCRIPT_DIR/avatar" && ./create-stock-avatar.sh $FORCE_FLAG)
