/**
 * Constants for the Project Creation Wizard
 */

import {
  FileCode,
  Folder,
  Layers,
  Building2,
  Zap,
  HelpCircle,
  Shield,
  Milestone,
  Bot,
} from 'lucide-react';

import type { ComplexityOption, ClientModeOption, AutonomyOption } from './types';

/**
 * Complexity options with descriptions
 * Note: Timelines match the exact requirements from Issue #50
 */
export const complexityOptions: ComplexityOption[] = [
  {
    id: 'script',
    label: 'Script',
    icon: FileCode,
    description: 'Single-file utilities, automation scripts, CLI tools',
    scope: 'Minutes to 1-2 hours, single file or small module',
    examples: 'Data migration script, API integration helper, Build tool plugin',
    skipConfig: true,
  },
  {
    id: 'simple',
    label: 'Simple',
    icon: Folder,
    description: 'Small applications with clear requirements',
    scope: '2-3 days, handful of files/components',
    examples: 'Landing page, REST API endpoint, Browser extension',
    skipConfig: false,
  },
  {
    id: 'medium',
    label: 'Medium',
    icon: Layers,
    description: 'Full applications with multiple features',
    scope: '2-3 weeks, multiple modules/services',
    examples: 'Admin dashboard, E-commerce store, Mobile app',
    skipConfig: false,
  },
  {
    id: 'complex',
    label: 'Complex',
    icon: Building2,
    description: 'Enterprise systems with many moving parts',
    scope: '2-3 months, distributed architecture',
    examples: 'SaaS platform, Microservices ecosystem, Data pipeline',
    skipConfig: false,
  },
];

/**
 * Client mode options
 */
export const clientModeOptions: ClientModeOption[] = [
  {
    id: 'technical',
    label: 'Technical Mode',
    icon: Zap,
    description: "I'll provide detailed technical specifications",
    details: [
      'Upload existing specs or PRDs',
      'Define API contracts and schemas',
      'Specify architecture patterns',
      'Direct sprint planning input',
    ],
  },
  {
    id: 'auto',
    label: 'Auto Mode',
    icon: HelpCircle,
    description: 'Help me figure out what I need',
    details: [
      'Guided requirements discovery',
      'AI suggests best practices',
      'Interactive brainstorming sessions',
      'Progressive refinement of scope',
    ],
  },
];

/**
 * Autonomy level options with approval matrix
 */
export const autonomyOptions: AutonomyOption[] = [
  {
    id: 'full_control',
    label: 'Full Control',
    icon: Shield,
    description: 'Review every action before it happens',
    approvals: {
      codeChanges: true,
      issueUpdates: true,
      architectureDecisions: true,
      sprintPlanning: true,
      deployments: true,
    },
    recommended: 'New users or critical projects',
  },
  {
    id: 'milestone',
    label: 'Milestone',
    icon: Milestone,
    description: 'Review at sprint boundaries',
    approvals: {
      codeChanges: false,
      issueUpdates: false,
      architectureDecisions: true,
      sprintPlanning: true,
      deployments: true,
    },
    recommended: 'Balanced control (recommended)',
  },
  {
    id: 'autonomous',
    label: 'Autonomous',
    icon: Bot,
    description: 'Only major decisions require approval',
    approvals: {
      codeChanges: false,
      issueUpdates: false,
      architectureDecisions: true,
      sprintPlanning: false,
      deployments: true,
    },
    recommended: 'Experienced users or low-risk projects',
  },
];

/**
 * Step configuration for wizard navigation
 */
export const WIZARD_STEPS = {
  BASIC_INFO: 1,
  COMPLEXITY: 2,
  CLIENT_MODE: 3,
  AUTONOMY: 4,
  AGENT_CHAT: 5,
  REVIEW: 6,
} as const;

/**
 * Total steps based on complexity mode
 */
export const getTotalSteps = (isScriptMode: boolean): number => {
  return isScriptMode ? 4 : 6;
};

/**
 * Get step labels based on complexity mode
 */
export const getStepLabels = (isScriptMode: boolean): string[] => {
  if (isScriptMode) {
    return ['Basic Info', 'Complexity', 'Agent Chat', 'Review'];
  }
  return ['Basic Info', 'Complexity', 'Client Mode', 'Autonomy', 'Agent Chat', 'Review'];
};

/**
 * Map actual step to display step for scripts
 */
export const getDisplayStep = (actualStep: number, isScriptMode: boolean): number => {
  if (!isScriptMode) return actualStep;

  // For scripts: 1->1, 2->2, 5->3, 6->4
  switch (actualStep) {
    case 1:
      return 1;
    case 2:
      return 2;
    case 5:
      return 3;
    case 6:
      return 4;
    default:
      return actualStep;
  }
};
