/**
 * Request Flow Registry
 * 
 * Central registry for all request flow types.
 * This provides a single import point for flow-specific components.
 * 
 * LOCATION: src/flows.ts
 * 
 * This file imports from flow folders at src/ level:
 * - src/custom/
 * - src/dealer-claim/
 * - src/shared/
 */

import { RequestFlowType } from '@/utils/requestTypeUtils';

// Import flow modules from src/ level
import * as CustomFlow from './custom';
import * as DealerClaimFlow from './dealer-claim';
import * as SharedComponents from './shared/components';

/**
 * Flow registry mapping
 * Maps RequestFlowType to their respective flow modules
 */
export const FlowRegistry = {
  CUSTOM: CustomFlow,
  DEALER_CLAIM: DealerClaimFlow,
} as const;

/**
 * Get flow module for a given flow type
 */
export function getFlowModule(flowType: RequestFlowType) {
  return FlowRegistry[flowType];
}

/**
 * Get overview tab component for a flow type
 */
export function getOverviewTab(flowType: RequestFlowType) {
  switch (flowType) {
    case 'DEALER_CLAIM':
      return DealerClaimFlow.DealerClaimOverviewTab;
    case 'CUSTOM':
    default:
      return CustomFlow.CustomOverviewTab;
  }
}

/**
 * Get workflow tab component for a flow type
 */
export function getWorkflowTab(flowType: RequestFlowType) {
  switch (flowType) {
    case 'DEALER_CLAIM':
      return DealerClaimFlow.DealerClaimWorkflowTab;
    case 'CUSTOM':
    default:
      return CustomFlow.CustomWorkflowTab;
  }
}

/**
 * Get create request component for a flow type
 */
export function getCreateRequestComponent(flowType: RequestFlowType) {
  switch (flowType) {
    case 'DEALER_CLAIM':
      return DealerClaimFlow.ClaimManagementWizard;
    case 'CUSTOM':
    default:
      return CustomFlow.CustomCreateRequest;
  }
}

/**
 * Get RequestDetail screen component for a flow type
 * Each flow has its own complete RequestDetail screen
 */
export function getRequestDetailScreen(flowType: RequestFlowType) {
  switch (flowType) {
    case 'DEALER_CLAIM':
      return DealerClaimFlow.DealerClaimRequestDetail;
    case 'CUSTOM':
    default:
      return CustomFlow.CustomRequestDetail;
  }
}

// Re-export flow modules for direct access
export { CustomFlow, DealerClaimFlow, SharedComponents };
export type { RequestFlowType } from '@/utils/requestTypeUtils';
