/**
 * Logging System English Translation
 * Module: logging
 */
export const logsEn = {
  // Module title
  title: 'Log Center',
  description: 'System log query and analysis',
  techOps: 'Tech Ops',

  // Navigation menu
  nav: {
    overview: 'Overview',
    query: 'Log Query',
    errors: 'Error Logs',
    slowRequests: 'Slow Requests',
    trace: 'Trace',
    config: 'Configuration',
    alerts: 'Alerts',
    statistics: 'Statistics',
  },

  // Overview page
  overview: {
    title: 'Log Overview',
    totalRequests: 'Total Requests',
    errorCount: 'Errors',
    warnCount: 'Warnings',
    slowRequestCount: 'Slow Requests',
    avgDuration: 'Avg Duration',
    p95Duration: 'P95 Duration',
    p99Duration: 'P99 Duration',
    errorRate: 'Error Rate',
    recentErrors: 'Recent Errors',
    recentSlowRequests: 'Recent Slow Requests',
    requestTrend: 'Request Trend',
    levelDistribution: 'Level Distribution',
    serviceDistribution: 'Service Distribution',
    regionDistribution: 'Region Distribution',
    diskUsage: 'Disk Usage',
    total: 'Total',
    used: 'Used',
    free: 'Free',
    usageRate: 'Usage Rate',
    performanceMetrics: 'Performance Metrics',
    viewMore: 'View More',
    noErrorLogs: 'No Error Logs',
    noSlowRequests: 'No Slow Requests',
    noDataAvailable: 'No Data Available',
    noAccessPermission: 'You don\'t have permission to access the logging system',
  },

  // Log query
  query: {
    title: 'Log Query',
    description: 'Query and search system logs',
    searchPlaceholder: 'Search log content, username...',
    filters: {
      level: 'Log Level',
      allLevels: 'All Levels',
      service: 'Service',
      region: 'Region',
      allRegions: 'All Regions',
      timeRange: 'Time Range',
      userId: 'User ID',
      userName: 'User Name',
      traceId: 'Trace ID',
      requestId: 'Request ID',
      url: 'URL',
      statusCode: 'Status Code',
      hasError: 'Errors Only',
      minDuration: 'Min Duration',
      maxDuration: 'Max Duration',
    },
    columns: {
      timestamp: 'Time',
      level: 'Level',
      message: 'Message',
      service: 'Service',
      method: 'Method',
      url: 'URL',
      statusCode: 'Status',
      duration: 'Duration',
      user: 'User',
      ip: 'IP',
      traceId: 'Trace ID',
      requestId: 'Request ID',
      actions: 'Actions',
    },
    actions: {
      viewTrace: 'View Trace',
      viewDetails: 'View Details',
      copyTraceId: 'Copy Trace ID',
      copyRequestId: 'Copy Request ID',
    },
    empty: 'No log data',
    timeRangeError: 'Time range cannot exceed 7 days',
    queryTooBoard: 'Query scope too broad, please add filters',
  },

  // Error logs
  errors: {
    title: 'Error Logs',
    description: 'View and analyze system errors',
    summary: 'Error Summary',
    byType: 'By Type',
    byHour: 'By Hour',
    columns: {
      timestamp: 'Time',
      type: 'Error Type',
      message: 'Error Message',
      code: 'Error Code',
      service: 'Service',
      url: 'URL',
      user: 'User',
      stack: 'Stack Trace',
    },
    empty: 'No error logs',
    viewStack: 'View Stack',
    copyStack: 'Copy Stack',
    searchPlaceholder: 'Search error messages...',
    viewFullTrace: 'View Full Trace',
  },

  // Slow requests
  slowRequests: {
    title: 'Slow Requests',
    description: 'Analyze requests with long response times',
    threshold: 'Slow Request Threshold',
    thresholdLabel: 'Threshold',
    thresholdMs: 'Threshold (ms)',
    summary: {
      total: 'Total Slow Requests',
      avgDuration: 'Avg Duration',
      maxDuration: 'Max Duration',
      p95Duration: 'P95 Duration',
      p99Duration: 'P99 Duration',
    },
    topPaths: 'Slowest Paths TOP',
    byService: 'By Service',
    columns: {
      timestamp: 'Time',
      method: 'Method',
      url: 'URL',
      duration: 'Duration',
      service: 'Service',
      region: 'Region',
      user: 'User',
      traceId: 'Trace ID',
    },
    empty: 'No slow requests',
  },

  // Trace
  trace: {
    title: 'Trace',
    description: 'Trace cross-service request chains',
    searchPlaceholder: 'Enter Trace ID or Request ID',
    search: 'Search',
    traceId: 'Trace ID',
    totalDuration: 'Total Duration',
    spanCount: 'Span Count',
    startTime: 'Start Time',
    endTime: 'End Time',
    timeline: 'Timeline',
    waterfall: 'Waterfall',
    spans: {
      title: 'Span List',
      spanId: 'Span ID',
      parentSpanId: 'Parent Span ID',
      service: 'Service',
      operation: 'Operation',
      duration: 'Duration',
      status: 'Status',
    },
    notFound: 'Trace not found',
    enterTraceId: 'Please enter a Trace ID to search',
    copyTraceId: 'Copy Trace ID',
    copySpanId: 'Copy Span ID',
  },

  // Configuration
  config: {
    title: 'Log Configuration',
    description: 'Manage logging system configuration',
    general: {
      title: 'General Settings',
      level: 'Log Level',
      levelDesc: 'Controls the verbosity of logged messages',
    },
    sampling: {
      title: 'Sampling Settings',
      enabled: 'Enable Sampling',
      enabledDesc: 'Automatically sample logs during high traffic',
      qpsThreshold: 'QPS Threshold',
      qpsThresholdDesc: 'Start sampling when exceeded',
      minSampleRate: 'Min Sample Rate',
      minSampleRateDesc: 'Minimum sampling ratio',
      maxSampleRate: 'Max Sample Rate',
      maxSampleRateDesc: 'Maximum sampling ratio',
      alwaysLog: 'Always Log',
      alwaysLogDesc: 'These levels and paths are always 100% logged',
      neverLog: 'Never Log',
      neverLogDesc: 'These paths are never logged',
    },
    retention: {
      title: 'Retention Policy',
      http: 'HTTP Logs',
      httpDesc: 'HTTP request/response log retention days',
      application: 'Application Logs',
      applicationDesc: 'Application log retention days',
      error: 'Error Logs',
      errorDesc: 'Error log retention days',
      days: 'days',
    },
    cleanup: {
      title: 'Log Cleanup',
      description: 'Manually clean up expired log files',
      type: 'Log Type',
      typeAll: 'All',
      olderThanDays: 'Days',
      olderThanDaysDesc: 'Clean logs older than this many days',
      dryRun: 'Dry Run',
      dryRunDesc: 'Preview only, no actual deletion',
      dryRunHint: 'Preview only',
      execute: 'Execute Cleanup',
      result: {
        title: 'Cleanup Result',
        deletedFiles: 'Files Deleted',
        freedSpace: 'Space Freed',
        dryRunNote: '(Dry run, not actually deleted)',
      },
    },
    save: 'Save Configuration',
    saving: 'Saving...',
    saved: 'Configuration saved',
    updatedAt: 'Updated At',
    updatedBy: 'Updated By',
  },

  // Alerts
  alerts: {
    title: 'Alert Management',
    description: 'Configure and view alerts',
    tabs: {
      history: 'Alert History',
      config: 'Alert Configuration',
    },
    history: {
      title: 'Alert History',
      empty: 'No alert records',
      columns: {
        time: 'Time',
        type: 'Type',
        severity: 'Severity',
        message: 'Message',
        channels: 'Channels',
        status: 'Status',
        actions: 'Actions',
      },
      summary: {
        total: 'Total Alerts',
        byType: 'By Type',
        byStatus: 'By Status',
      },
      viewDetails: 'View Details',
      acknowledge: 'Acknowledge',
    },
    config: {
      title: 'Alert Configuration',
      slowRequest: {
        title: 'Slow Request Alert',
        enabled: 'Enabled',
        thresholdMs: 'Threshold (ms)',
        thresholdMsDesc: 'Trigger alert when response time exceeds',
        excludePaths: 'Exclude Paths',
        excludePathsDesc: 'These paths will not trigger alerts (e.g., file uploads)',
      },
      errorRate: {
        title: 'High Error Rate Alert',
        enabled: 'Enabled',
        thresholdPercent: 'Threshold (%)',
        thresholdPercentDesc: 'Trigger alert when error rate exceeds',
        windowMinutes: 'Window (minutes)',
        windowMinutesDesc: 'Statistics time window',
        minRequests: 'Min Requests',
        minRequestsDesc: 'Minimum requests in window to trigger',
      },
      ipAnomaly: {
        title: 'IP Anomaly Alert',
        enabled: 'Enabled',
        maxRequestsPerMinute: 'Max Requests/Minute',
        maxRequestsPerMinuteDesc: 'Trigger when single IP exceeds',
        blockDurationMinutes: 'Block Duration (minutes)',
        blockDurationMinutesDesc: 'Block duration after trigger',
      },
      diskSpace: {
        title: 'Disk Space Alert',
        enabled: 'Enabled',
        warningPercent: 'Warning Threshold (%)',
        warningPercentDesc: 'Send warning when usage exceeds',
        criticalPercent: 'Critical Threshold (%)',
        criticalPercentDesc: 'Send critical alert when usage exceeds',
      },
      notifications: {
        title: 'Notification Channels',
        slack: 'Slack',
        feishu: 'Feishu',
        email: 'Email',
        enabled: 'Enabled',
        configured: 'Configured',
        notConfigured: 'Not Configured',
        webhookUrl: 'Webhook URL',
        recipients: 'Recipients',
        test: 'Test',
        testing: 'Testing...',
        testSuccess: 'Test successful',
        testFailed: 'Test failed',
      },
      save: 'Save Configuration',
      saving: 'Saving...',
      saved: 'Configuration saved',
    },
  },

  // Statistics
  statistics: {
    title: 'Statistics',
    description: 'Log statistics and trend analysis',
    period: 'Period',
    groupBy: 'Group By',
    groupByOptions: {
      hour: 'By Hour',
      day: 'By Day',
      service: 'By Service',
      level: 'By Level',
      region: 'By Region',
    },
    charts: {
      requestTrend: 'Request Trend',
      errorTrend: 'Error Trend',
      durationTrend: 'Duration Trend',
      levelDistribution: 'Level Distribution',
      serviceDistribution: 'Service Distribution',
      regionDistribution: 'Region Distribution',
    },
  },

  // Log levels
  level: {
    error: 'Error',
    warn: 'Warning',
    info: 'Info',
    debug: 'Debug',
  },

  // Alert types
  alertType: {
    slowRequest: 'Slow Request',
    highErrorRate: 'High Error Rate',
    diskSpace: 'Disk Space',
    ipAnomaly: 'IP Anomaly',
  },

  // Alert severity
  severity: {
    critical: 'Critical',
    warning: 'Warning',
    info: 'Info',
  },

  // Alert status
  alertStatus: {
    sent: 'Sent',
    failed: 'Failed',
    acknowledged: 'Acknowledged',
  },

  // Regions
  region: {
    CN: 'China',
    US: 'United States',
    UAE: 'UAE',
  },

  // Common
  common: {
    search: 'Search',
    filter: 'Filter',
    reset: 'Reset',
    refresh: 'Refresh',
    export: 'Export',
    loading: 'Loading...',
    noData: 'No data',
    viewMore: 'View More',
    copy: 'Copy',
    copied: 'Copied',
    save: 'Save',
    cancel: 'Cancel',
    confirm: 'Confirm',
    timeRange: {
      last1h: 'Last 1 hour',
      last6h: 'Last 6 hours',
      last24h: 'Last 24 hours',
      last7d: 'Last 7 days',
      last30d: 'Last 30 days',
      custom: 'Custom',
    },
  },

  // Error messages
  error: {
    loadFailed: 'Failed to load',
    saveFailed: 'Failed to save',
    queryFailed: 'Query failed',
    cleanupFailed: 'Cleanup failed',
    timeRangeTooLarge: 'Time range too large (max 7 days)',
    queryTooBroad: 'Query scope too broad, please add filters',
    traceNotFound: 'Trace ID not found',
    permissionDenied: 'Permission denied',
  },

  // Permission hints
  permission: {
    noAccess: 'You do not have permission to access the log system',
    noConfigAccess: 'You do not have permission to modify configuration',
    noCleanupAccess: 'You do not have permission to clean up logs',
    noAlertAccess: 'You do not have permission to manage alerts',
  },

  // Footer info
  footer: {
    technicalOps: 'Technical Operations',
  },

  // User Guide
  help: {
    title: 'User Guide',
    subtitle: 'Quick overview of the logging system',
    nav: 'User Guide',
    intro: {
      title: 'What is this',
      paragraph:
        'The logging system captures runtime technical logs — HTTP requests, error stacks, latency, Temporal workflows. It powers development debugging, ops monitoring and incident triage. Business compliance trails live in the audit system, not here.',
      highlights: [
        { title: 'Auto-instrumented', desc: 'Every API call captured by the interceptor: method, path, status, latency, user, IP' },
        { title: 'Distributed tracing', desc: 'traceId / spanId follow a single request across services' },
        { title: 'Never lose errors', desc: 'When buffers overflow, DEBUG/INFO are dropped first; ERROR/WARN always fall back to file' },
      ],
    },
    concepts: {
      title: 'Core Concepts',
      description: 'Know these terms before you start triaging',
      items: [
        { term: 'SystemLog', desc: 'Main log table storing structured entries (DEBUG / INFO / WARN / ERROR / FATAL)' },
        { term: 'requestId', desc: 'Per-HTTP-request unique ID; surfaced in X-Request-Id response header (visible in browser DevTools)' },
        { term: 'traceId / spanId', desc: 'Cross-service distributed-tracing IDs. traceId stays constant across the chain; spanId marks each node' },
        { term: 'Log levels', desc: 'DEBUG < INFO < WARN < ERROR < FATAL. Default in prod is INFO+; tunable per module on the config page' },
        { term: 'Sampling', desc: 'High-QPS paths can run at a fraction (e.g. 10%) to manage storage cost' },
        { term: 'Buffer overflow', desc: 'When the in-memory buffer fills up, DEBUG/INFO drop first. ERROR/WARN always reach the file sink' },
        { term: 'Redaction', desc: 'password / token / Authorization etc. are redacted at the interceptor — DB never sees raw values' },
      ],
    },
    roles: {
      title: 'Roles & Access',
      description: 'Logging is not exposed to business users',
      columnHeaders: { role: 'Role', scope: 'Scope', desc: 'Description' },
      items: [
        { code: 'Administrator', name: 'System Admin', scope: 'All', desc: 'Query + config + alerts + cleanup' },
        { code: 'Operations / SRE', name: 'Ops / SRE', scope: 'All', desc: 'Query + alerts read + config read-only' },
        { code: 'Engineer', name: 'Backend engineer', scope: 'All (dev / staging)', desc: 'Query + trace lookup' },
        { code: 'Business User', name: 'Business user', scope: 'None', desc: 'Logging system is not exposed to business users' },
      ],
    },
    tasks: {
      title: 'Common Tasks',
      description: 'Click a card to jump in',
      cards: [
        { id: 'overview', name: 'Overview', desc: 'Recent error rate / QPS / slow-request top N' },
        { id: 'query', name: 'Log Query', desc: 'Full-text search by time / level / module / keyword' },
        { id: 'errors', name: 'Errors', desc: 'ERROR / FATAL only, grouped by error fingerprint' },
        { id: 'slowRequests', name: 'Slow Requests', desc: 'Requests slower than the configured threshold (default 3s)' },
        { id: 'trace', name: 'Trace', desc: 'Look up a full traceId and see the span call graph' },
        { id: 'statistics', name: 'Statistics', desc: 'Charts of error rate / latency distribution / module breakdown' },
        { id: 'config', name: 'Config', desc: 'Log levels, retention, sampling, redaction lists (requires logs:config)' },
        { id: 'alerts', name: 'Alerts', desc: 'Slow requests / error spike / buffer overflow rules & history' },
      ],
    },
  },
};

export type LogsTranslation = typeof logsEn;

