/**
 * HTML Editor Messages
 *
 * Internationalization messages for the HTML Editor component
 * Following project conventions for message structure
 */

import { defineMessages } from 'react-intl';

export const scope = 'app.components.HtmlEditor';

export default defineMessages({
  // Main component messages
  initializing: {
    id: `${scope}.initializing`,
    defaultMessage: 'Initializing HTML Editor...',
  },

  // Label insertion messages
  addLabel: {
    id: `${scope}.addLabel`,
    defaultMessage: 'Add label',
  },
  labelInserted: {
    id: `${scope}.labelInserted`,
    defaultMessage: 'Label inserted successfully',
  },
  labelInsertedDescription: {
    id: `${scope}.labelInsertedDescription`,
    defaultMessage: 'The label "{label}" has been inserted at the cursor position',
  },
  labelInsertError: {
    id: `${scope}.labelInsertError`,
    defaultMessage: 'Failed to insert label',
  },
  editorNotReady: {
    id: `${scope}.editorNotReady`,
    defaultMessage: 'Editor is not ready. Please try again.',
  },
  editorMethodNotAvailable: {
    id: `${scope}.editorMethodNotAvailable`,
    defaultMessage: 'Editor method not available. Please refresh and try again.',
  },

  // Save messages
  contentSaved: {
    id: `${scope}.contentSaved`,
    defaultMessage: 'Content saved successfully',
  },
  saveError: {
    id: `${scope}.saveError`,
    defaultMessage: 'Failed to save content',
  },
  autoSaveEnabled: {
    id: `${scope}.autoSaveEnabled`,
    defaultMessage: 'Auto-save is enabled',
  },
  autoSaveDisabled: {
    id: `${scope}.autoSaveDisabled`,
    defaultMessage: 'Auto-save is disabled',
  },

  // Editor toolbar messages
  htmlEditor: {
    id: `${scope}.htmlEditor`,
    defaultMessage: 'Email content',
  },
  desktop: {
    id: `${scope}.desktop`,
    defaultMessage: 'Desktop',
  },
  mobile: {
    id: `${scope}.mobile`,
    defaultMessage: 'Mobile',
  },
  mobileDevice: {
    id: `${scope}.mobileDevice`,
    defaultMessage: 'Mobile Device',
  },
  htmlPreview: {
    id: `${scope}.htmlPreview`,
    defaultMessage: 'HTML Preview',
  },
  fullscreen: {
    id: `${scope}.fullscreen`,
    defaultMessage: 'Fullscreen',
  },
  enterFullscreen: {
    id: `${scope}.enterFullscreen`,
    defaultMessage: 'Enter Fullscreen',
  },
  exitFullscreen: {
    id: `${scope}.exitFullscreen`,
    defaultMessage: 'Exit Fullscreen',
  },
  save: {
    id: `${scope}.save`,
    defaultMessage: 'Save',
  },

  // Editor tabs messages
  htmlTab: {
    id: `${scope}.htmlTab`,
    defaultMessage: 'HTML',
  },
  cssTab: {
    id: `${scope}.cssTab`,
    defaultMessage: 'CSS',
  },
  javascriptTab: {
    id: `${scope}.javascriptTab`,
    defaultMessage: 'JavaScript',
  },

  // Preview messages
  previewTitle: {
    id: `${scope}.previewTitle`,
    defaultMessage: 'Preview',
  },
  previewLoading: {
    id: `${scope}.previewLoading`,
    defaultMessage: 'Loading preview...',
  },
  previewError: {
    id: `${scope}.previewError`,
    defaultMessage: 'Preview error',
  },
  refreshPreview: {
    id: `${scope}.refreshPreview`,
    defaultMessage: 'Refresh Preview',
  },

  // Mobile device preview messages
  android: {
    id: `${scope}.android`,
    defaultMessage: 'Android',
  },
  ios: {
    id: `${scope}.ios`,
    defaultMessage: 'iOS',
  },
  devicePreview: {
    id: `${scope}.devicePreview`,
    defaultMessage: 'Device Preview',
  },

  // InApp variant messages
  inAppEditor: {
    id: `${scope}.inAppEditor`,
    defaultMessage: 'In-app content',
  },
  keepContentSameForBoth: {
    id: `${scope}.keepContentSameForBoth`,
    defaultMessage: 'Keep content same for both',
  },

  // Validation messages
  validationErrors: {
    id: `${scope}.validationErrors`,
    defaultMessage: '{count} validation {count, plural, one {error} other {errors}}',
  },
  validationWarnings: {
    id: `${scope}.validationWarnings`,
    defaultMessage: '{count} validation {count, plural, one {warning} other {warnings}}',
  },
  noValidationIssues: {
    id: `${scope}.noValidationIssues`,
    defaultMessage: 'No validation issues',
  },
  showProblems: {
    id: `${scope}.showProblems`,
    defaultMessage: 'Show Problems',
  },
  hideProblems: {
    id: `${scope}.hideProblems`,
    defaultMessage: 'Hide Problems',
  },

  // Error messages
  securityError: {
    id: `${scope}.securityError`,
    defaultMessage: 'Security Error',
  },
  runtimeError: {
    id: `${scope}.runtimeError`,
    defaultMessage: 'Runtime Error',
  },
  renderError: {
    id: `${scope}.renderError`,
    defaultMessage: 'Render Error',
  },
  clearErrors: {
    id: `${scope}.clearErrors`,
    defaultMessage: 'Clear Errors',
  },
  copyError: {
    id: `${scope}.copyError`,
    defaultMessage: 'Copy Error Details',
  },
  errorCopied: {
    id: `${scope}.errorCopied`,
    defaultMessage: 'Error details copied to clipboard',
  },

  // Placeholder messages
  editorPlaceholderEmail: {
    id: `${scope}.editorPlaceholderEmail`,
    defaultMessage: 'Write your HTML email code here...',
  },
  editorPlaceholderInapp: {
    id: `${scope}.editorPlaceholderInapp`,
    defaultMessage: 'Write your HTML inapp code here...',
  },

  // Accessibility messages
  codeEditor: {
    id: `${scope}.codeEditor`,
    defaultMessage: 'Email Editor',
  },
  previewPanel: {
    id: `${scope}.previewPanel`,
    defaultMessage: 'Preview Panel',
  },
  resizeHandle: {
    id: `${scope}.resizeHandle`,
    defaultMessage: 'Drag to resize panels',
  },
  splitPanels: {
    id: `${scope}.splitPanels`,
    defaultMessage: 'Split panels - code editor and preview',
  },

  // Performance messages
  optimizing: {
    id: `${scope}.optimizing`,
    defaultMessage: 'Optimizing performance...',
  },
  performanceWarning: {
    id: `${scope}.performanceWarning`,
    defaultMessage: 'Large content detected. Performance may be affected.',
  },

  // Feature messages
  autoSave: {
    id: `${scope}.autoSave`,
    defaultMessage: 'Auto-save',
  },
  lastSaved: {
    id: `${scope}.lastSaved`,
    defaultMessage: 'Last saved: {time}',
  },
  unsavedChanges: {
    id: `${scope}.unsavedChanges`,
    defaultMessage: 'You have unsaved changes',
  },

  // Content Sanitizer messages
  sanitizer: {
    invalidInput: {
      id: `${scope}.sanitizer.invalidInput`,
      defaultMessage: 'Invalid input: HTML content must be a string',
    },
    invalidInputNonEmpty: {
      id: `${scope}.sanitizer.invalidInputNonEmpty`,
      defaultMessage: 'Invalid input: HTML content must be a non-empty string',
    },
    sanitizationFailed: {
      id: `${scope}.sanitizer.sanitizationFailed`,
      defaultMessage: 'Sanitization failed: {error}',
    },
    dangerousProtocolDetected: {
      id: `${scope}.sanitizer.dangerousProtocolDetected`,
      defaultMessage: 'Dangerous protocol detected',
    },

    // Email compatibility warnings
    emailMultimediaNotSupported: {
      id: `${scope}.sanitizer.emailMultimediaNotSupported`,
      defaultMessage: 'Video/audio/canvas elements may not be supported in email clients',
    },
    emailPositioningNotSupported: {
      id: `${scope}.sanitizer.emailPositioningNotSupported`,
      defaultMessage: 'Fixed/sticky positioning may not work in email clients',
    },
    emailModernCssLimited: {
      id: `${scope}.sanitizer.emailModernCssLimited`,
      defaultMessage: 'CSS Grid and Flexbox have limited support in email clients',
    },
    emailViewportUnitsNotSupported: {
      id: `${scope}.sanitizer.emailViewportUnitsNotSupported`,
      defaultMessage: 'Viewport units and rem may not be supported in all email clients',
    },

    // Mobile optimization warnings
    mobileTablesNotFriendly: {
      id: `${scope}.sanitizer.mobileTablesNotFriendly`,
      defaultMessage: 'Tables may not be mobile-friendly - consider using flexbox or grid',
    },
    mobileRelativeFontSizes: {
      id: `${scope}.sanitizer.mobileRelativeFontSizes`,
      defaultMessage: 'Consider using relative font sizes (em, rem, %) for better mobile scaling',
    },
    mobileFixedWidthsProblematic: {
      id: `${scope}.sanitizer.mobileFixedWidthsProblematic`,
      defaultMessage: 'Large fixed widths may not work well on mobile devices',
    },
    mobileRelativeUnits: {
      id: `${scope}.sanitizer.mobileRelativeUnits`,
      defaultMessage: 'Consider using relative units (rem, em, %) for better mobile responsiveness',
    },

    // Production recommendations
    productionValidHtml: {
      id: `${scope}.sanitizer.productionValidHtml`,
      defaultMessage: 'Provide valid HTML content before deploying to production',
    },
    productionSanitized: {
      id: `${scope}.sanitizer.productionSanitized`,
      defaultMessage: 'Content has been sanitized for security - review changes before deploying',
    },
    productionInlineCss: {
      id: `${scope}.sanitizer.productionInlineCss`,
      defaultMessage: 'Consider inlining CSS for better email client compatibility',
    },
    productionLargeContent: {
      id: `${scope}.sanitizer.productionLargeContent`,
      defaultMessage: 'Content is large ({size} characters) - consider optimizing for mobile performance',
    },
  },

  htmlEditorTooltip: {
    id: `${scope}.htmlEditorTooltip`,
    defaultMessage: 'This editor supports standard HTML for emails. Avoid CSS frameworks, external stylesheets, and scripts. {docLink}',
  },

  viewDocumentation: {
    id: `${scope}.viewDocumentation`,
    defaultMessage: 'View documentation',
  },

  // HTML Validator messages
  validator: {
    // General validation messages
    validationFailed: {
      id: `${scope}.validator.validationFailed`,
      defaultMessage: 'Validation failed: {error}',
    },
    liquidValidationFailed: {
      id: `${scope}.validator.liquidValidationFailed`,
      defaultMessage: 'Liquid validation failed',
    },

    // Security validation messages
    unsafeProtocolDetected: {
      id: `${scope}.validator.unsafeProtocolDetected`,
      defaultMessage: 'Potentially unsafe protocol detected: {protocol}',
    },
    scriptTagsDetected: {
      id: `${scope}.validator.scriptTagsDetected`,
      defaultMessage: 'Script tags detected - may be filtered in production',
    },

    // Email-specific validation messages
    outlookIncompatible: {
      id: `${scope}.validator.outlookIncompatible`,
      defaultMessage: 'Element may not be supported in Outlook: {element}',
    },
    emailCssUnsupported: {
      id: `${scope}.validator.emailCssUnsupported`,
      defaultMessage: 'CSS feature may not be supported in email clients',
    },

    // Mobile/InApp validation messages
    mobileIncompatible: {
      id: `${scope}.validator.mobileIncompatible`,
      defaultMessage: 'Element may not be supported on mobile: {element}',
    },
    largeImageDetected: {
      id: `${scope}.validator.largeImageDetected`,
      defaultMessage: 'Large image dimensions detected - consider mobile optimization',
    },

    // CSS validation messages
    unclosedCssRule: {
      id: `${scope}.validator.unclosedCssRule`,
      defaultMessage: 'Unclosed CSS rule detected',
    },
    emptyCssRule: {
      id: `${scope}.validator.emptyCssRule`,
      defaultMessage: 'Empty CSS rule detected',
    },
    cssValidationFailed: {
      id: `${scope}.validator.cssValidationFailed`,
      defaultMessage: 'CSS validation failed: {error}',
    },
  },
});
