#!/bin/bash
# Create standard Qdrant collections for a new agent
# Usage: ./create_agent_collections.sh <agent_id>

AGENT_ID=$1
QDRANT_URL=${QDRANT_URL:-http://localhost:6333}
DIMENSION=1024

if [ -z "$AGENT_ID" ]; then
    echo "Usage: $0 <agent_id>"
    exit 1
fi

COLLECTIONS=("messages" "docs" "memory_items" "user_context")

echo "Creating collections for agent: $AGENT_ID"

for type in "${COLLECTIONS[@]}"; do
    collection="${AGENT_ID}_${type}"
    echo -n "  ${collection}... "
    
    RESULT=$(curl -sS -X PUT "${QDRANT_URL}/collections/${collection}" \
        -H "Content-Type: application/json" \
        -d {vectors: {size: "${DIMENSION}", distance: Cosine}} 2>&1)
    
    if echo "$RESULT" | grep -q "true"; then
        echo "created"
    else
        echo "exists or error"
    fi
done

echo "Done!"
