#!/bin/bash
# Fleet Room Bootstrap Script
# Run AFTER Conduit is deployed and Alexander's admin account exists

HOMESERVER="https://matrix.fleet.tld"
ADMIN_USER="@alexander:matrix.fleet.tld"
ACCESS_TOKEN=""  # Fill after login

# Room creation template
create_room() {
    local room_name=$1
    local room_alias=$2
    local topic=$3
    local preset=$4  # public_chat, private_chat, trusted_private_chat
    
    curl -X POST "$HOMESERVER/_matrix/client/r0/createRoom" \
        -H "Authorization: Bearer $ACCESS_TOKEN" \
        -H "Content-Type: application/json" \
        -d "{
            "name": "$room_name",
            "room_alias_name": "$room_alias",
            "topic": "$topic",
            "preset": "$preset",
            "creation_content": {"m.federate": true}
        }"
}

echo "=== Fleet Room Bootstrap ==="

# Core fleet rooms
create_room "Fleet Command" "fleet-command" "Sovereign operator channel" "trusted_private_chat"
create_room "General Chat" "general" "Open discussion" "public_chat"
create_room "Agent Alerts" "agent-alerts" "Automated agent notifications" "public_chat"
create_room "Dev Channel" "dev" "Development coordination" "private_chat"

echo "Rooms created. Add users via Element or invite API."
