/**
 * {{titleCase name}} Activities
 *
 * Activities are the building blocks of workflows. They handle
 * non-deterministic operations like API calls, database queries,
 * and external service interactions.
 *
 * Activities can:
 * - Make HTTP requests
 * - Query databases
 * - Send emails/notifications
 * - Access the file system
 * - Use Date.now(), Math.random(), etc.
 */

// `log` carries the activity context and reaches the platform logger the worker
// installs — never the console (the Mesh app contract, gate 0.4).
import { log } from "@temporalio/activity";

/**
 * Generate a greeting message
 */
export async function greet(name: string): Promise<string> {
  log.info("Generating greeting", { name });
  return `Hello, ${name}!`;
}

/**
 * Process a task (simulated)
 */
export async function processTask(taskId: string): Promise<string> {
  log.info("Processing task", { taskId });

  // Simulate processing time
  await new Promise((resolve) => setTimeout(resolve, 1000));

  return "completed";
}

/**
 * Send a notification (simulated)
 */
export async function sendNotification(
  userId: string,
  message: string
): Promise<boolean> {
  log.info("Sending notification", { userId, message });

  // Simulate sending
  await new Promise((resolve) => setTimeout(resolve, 500));

  return true;
}
