/**
 * Workflow orchestration package
 * Supports both Temporal and AWS Step Functions
 */

// Export temporal types (these are the primary types)
export * from './temporal';
// Step-functions types conflict with temporal, so we only export the client
export {
  getStepFunctionsWorkflowClient,
} from './step-functions';

export type WorkflowProvider = 'temporal' | 'step-functions';

export interface WorkflowClient {
  startCredentialIssuanceWorkflow(input: unknown): Promise<string>;
  getWorkflowStatus(workflowId: string): Promise<unknown>;
  cancelWorkflow?(workflowId: string): Promise<void>;
  stopWorkflow?(workflowId: string, error?: string): Promise<void>;
}

/**
 * Get workflow client based on provider
 */
export function getWorkflowClient(provider: WorkflowProvider = 'temporal'): WorkflowClient {
  if (provider === 'step-functions') {
    const { getStepFunctionsWorkflowClient } = require('./step-functions');
    return getStepFunctionsWorkflowClient();
  } else {
    const { getTemporalWorkflowClient } = require('./temporal');
    return getTemporalWorkflowClient();
  }
}
