import type { FormSchema } from '../../../forms/types'

/**
 * Action configuration for HITL tasks
 * Defines available user actions and their behavior
 */
export interface ActionConfig {
  /** Unique action identifier (e.g., 'approve', 'retry', 'escalate') */
  id: string

  /** Display label for UI button */
  label: string

  /** Button variant/style */
  type: 'primary' | 'secondary' | 'danger' | 'outline'

  /** Tabler icon name (e.g., 'IconCheck', 'IconRefresh') */
  icon?: string

  /** Button color (Mantine theme colors) */
  color?: string

  /** Button variant (Mantine button variant, e.g., 'light', 'filled', 'outline') */
  variant?: string

  /** Execution target (agent/workflow to invoke) */
  target?: {
    resourceType: 'agent' | 'workflow'
    resourceId: string
    /**
     * Optional session ID for agent continuation.
     * If provided, invokes a new turn on the existing session instead of standalone execution.
     * Only valid when resourceType is 'agent'.
     */
    sessionId?: string
  }

  /** Form schema for collecting action-specific data */
  form?: FormSchema

  /** Payload template for pre-filling forms */
  payloadTemplate?: unknown

  /** Requires confirmation dialog */
  requiresConfirmation?: boolean

  /** Confirmation message */
  confirmationMessage?: string

  /** Help text / tooltip */
  description?: string
}
