#!/usr/bin/env bash
#
# Copy channel-gated bundled skills into the app bundle.
#
# Usage:
#   copy_conditional_skills <channel> <gated_skills_src> <dest_skills_dir>
#
# Arguments:
#   channel:          Release channel (oss or integration).
#   gated_skills_src: Path to resources/channel-gated-skills/.
#   dest_skills_dir:  Destination skills directory (e.g. .../bundled/skills/).
#

set -e

if [ $# -ne 3 ]; then
  echo "Usage: $0 <channel> <gated_skills_src> <dest_skills_dir>" >&2
  exit 1
fi

CHANNEL="$1"
GATED_SKILLS_SRC="$2"
DEST_SKILLS_DIR="$3"

if [ ! -d "$GATED_SKILLS_SRC" ]; then
  exit 0
fi

# OSS and integration bundles have no gated skills.
case "$CHANNEL" in
  oss|integration)
    echo "  Channel '$CHANNEL' has no gated skills, skipping"
    exit 0
    ;;
  *)
    echo "Error: unsupported release channel '$CHANNEL'" >&2
    exit 1
    ;;
esac
