<?php
if (!defined('ABSPATH')) exit;

function asana_automator_comment_on_section_move($config, $token, $task) {
    $comment = trim($config['comment_text'] ?? '');
    if (!$comment || empty($task['gid'])) return;

    wp_remote_post("https://app.asana.com/api/1.0/tasks/{$task['gid']}/stories", [
        'headers' => [
            'Authorization' => 'Bearer ' . $token,
            'Content-Type' => 'application/json'
        ],
        'body' => json_encode(['text' => $comment])
    ]);
}
