import { Employee, Report, Submission, FaqItem, CompanyReport } from './src/types';

// URL Configuration - reads from environment variables with fallbacks
export const SITE_URL = import.meta.env.VITE_SITE_URL || 'http://localhost:5173';

// API Base URL - auto-detect development vs production
const isLocalhost = typeof window !== 'undefined' &&
  (window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1');

// Use Firebase Functions emulator in development, production functions in production
export const API_URL = isLocalhost
  ? 'http://127.0.0.1:5002/auditly-c0027/us-central1'  // Firebase Functions Emulator
  : 'https://us-central1-auditly-c0027.cloudfunctions.net';       // Production Firebase Functions

// Log URL configuration in development
if (import.meta.env.DEV) {
  console.log('🌐 Frontend URL Configuration:');
  console.log(`   SITE_URL: ${SITE_URL}`);
  console.log(`   API_URL: ${API_URL}`);
}

// DEPRECATED: These are legacy sample data that should not be used in production
// Real data should be generated via AI backend calls or user input
export const EMPLOYEES: Employee[] = [];

// DEPRECATED: Sample report data - real reports should be generated via /generateEmployeeReport API
export const REPORT_DATA: Report = {
  employeeId: 'sample',
  department: 'Sample Department',
  role: 'Sample Role',
  roleAndOutput: {
    responsibilities: 'This is sample data. Real reports are generated via AI.',
    clarityOnRole: 'Sample data',
    selfRatedOutput: 'Sample data',
    recurringTasks: 'Sample data',
  },
  insights: {
    personalityTraits: 'Sample data - use AI-generated reports',
    psychologicalIndicators: ['Sample data'],
    selfAwareness: 'Sample data',
    emotionalResponses: 'Sample data',
    growthDesire: 'Sample data',
  },
  strengths: ['Sample data - use AI-generated reports'],
  weaknesses: [
    { isCritical: false, description: 'Sample data - use AI-generated reports' }
  ],
  opportunities: {
    roleAdjustment: 'Sample data',
    accountabilitySupport: 'Sample data',
  },
  risks: ['Sample data - use AI-generated reports'],
  recommendation: {
    action: 'Keep',
    details: ['Sample data - use AI-generated reports'],
  },
  grading: [],
};

// DEPRECATED: Sample submission data - real submissions come from employee questionnaires
export const SUBMISSIONS_DATA: Submission = {
  employeeId: 'sample',
  answers: [
    {
      question: 'Sample question',
      answer: 'Sample answer - real data comes from employee questionnaires',
    }
  ],
};

export const FAQ_DATA: FaqItem[] = [
  {
    question: "What is the process for submitting a support ticket?",
    answer: "Team members will undergo evaluations every three months, focusing on their performance, teamwork, and communication skills. Role advancements will be considered at these intervals."
  },
  {
    question: "How can I reset my password?",
    answer: "You can reset your password by clicking the 'Forgot Password' link on the login page. An email will be sent to you with instructions."
  },
  {
    question: "What are the criteria for performance reviews?",
    answer: "Performance reviews are based on a combination of self-assessment, peer feedback, and manager evaluation. Key criteria include goal achievement, collaboration, and contribution to company values."
  },
  {
    question: "How can I access the company's training resources?",
    answer: "All training resources are available in the 'Company Wiki' section of the platform. You can find documents, videos, and links to external courses."
  },
  {
    question: "What should I do if I encounter a technical issue?",
    answer: "For any technical issues, please submit a ticket through the 'Help & Support' page. Our IT team will get back to you within 24 hours."
  },
  {
    question: "How do I provide feedback on team projects?",
    answer: "Feedback can be provided directly within the project management tool or during scheduled team retrospectives. We encourage open and constructive communication."
  }
];

export const CHAT_STARTERS = [
  "Summarize the latest employee reports.",
  "What are the company's organizational strengths?",
  "Identify any risks in our current workforce.",
  "Which employees should be considered for promotion?",
  "What are our immediate hiring needs?",
  "How can we improve team performance?"
];

// DEPRECATED: This should not be used in production - real company reports are AI-generated
export const SAMPLE_COMPANY_REPORT: CompanyReport = {
  id: 'placeholder-report',
  createdAt: Date.now(),
  overview: {
    totalEmployees: 0,
    departmentBreakdown: [],
    submissionRate: 0,
    lastUpdated: Date.now(),
    averagePerformanceScore: 0,
    riskLevel: 'Low'
  },
  gradingBreakdown: [],
  operatingPlan: { nextQuarterGoals: [], keyInitiatives: [], resourceNeeds: [], riskMitigation: [] },
  personnelChanges: { newHires: [], promotions: [], departures: [] },
  keyPersonnelChanges: [],
  immediateHiringNeeds: [],
  forwardOperatingPlan: {
    quarterlyGoals: [],
    resourceNeeds: [],
    riskMitigation: []
  },
  organizationalStrengths: [],
  organizationalRisks: [],
  gradingOverview: {},
  executiveSummary: `Welcome to Auditly! Generate your first AI-powered company report by inviting employees and completing the onboarding process.`
};