export const DEFAULT_FORM_STYLES = {
  headerStyle: {
    fontFamily: 'Helvetica',
    fontSize: 16,
    fontWeight: 'bold',
    color: '#000000',
    textAlign: 'left',
    marginBottom: 20
  },
  bodyStyle: {
    fontFamily: 'Helvetica',
    fontSize: 9,
    fontWeight: 'normal',
    color: '#000000',
    lineHeight: 1.5,
    textAlign: 'justify'
  },
  footerStyle: {
    fontFamily: 'Helvetica',
    fontSize: 9,
    color: '#64748b',
    textAlign: 'center',
    marginTop: 20
  },
  page: {
    marginTop: 48, 
    marginBottom: 48,
    marginLeft: 48,
    marginRight: 48,
    backgroundColor: '#ffffff'
  }
};

export const STANDARD_FONTS = {
  'Helvetica': "Helvetica, Arial, sans-serif",
  'Arial': "Arial, Helvetica, sans-serif",
  'Times New Roman': "'Times New Roman', Times, serif",
  'Georgia': "Georgia, serif",
  'Courier': "'Courier New', Courier, monospace",
  'Verdana': "Verdana, Geneva, sans-serif"
};

export const SYMBOL_FONTS = {
  'Standard': 'ZapfDingbats', // PDF standard symbol font
  'Fallback': 'Helvetica'
};

export const COMMON_SYMBOLS = [
  { char: '□', name: 'Empty Square' },
  { char: '☑', name: 'Checked Box' },
  { char: '✓', name: 'Checkmark' },
  { char: '✗', name: 'Cross' },
  { char: '○', name: 'Empty Circle' },
  { char: '●', name: 'Filled Circle' },
  { char: '◆', name: 'Diamond' },
  { char: '◇', name: 'Empty Diamond' },
  { char: '★', name: 'Star' },
  { char: '☆', name: 'Empty Star' },
  { char: '▸', name: 'Small Arrow' },
  { char: '—', name: 'Em Dash' }
];

export const NESTED_BULLET_STYLES = {
  1: { marginLeft: '2em' },
  2: { marginLeft: '4em' },
  3: { marginLeft: '6em' },
  4: { marginLeft: '8em' },
  5: { marginLeft: '10em' },
  6: { marginLeft: '12em' }
};

export const applyFormStyles = (element, styles = {}, type = 'body') => {
  if (!element) return {};
  
  const defaults = DEFAULT_FORM_STYLES[`${type}Style`] || {};
  const merged = { ...defaults, ...styles };
  
  const fontFamilyStack = STANDARD_FONTS[merged.fontFamily] || merged.fontFamily || "Helvetica, Arial, sans-serif";

  return {
    fontFamily: fontFamilyStack,
    fontSize: `${merged.fontSize}pt`,
    fontWeight: merged.fontWeight,
    fontStyle: merged.fontStyle || 'normal',
    color: merged.color,
    textAlign: merged.textAlign,
    lineHeight: merged.lineHeight,
    backgroundColor: merged.backgroundColor || 'transparent'
  };
};

export const getNestedBulletStyle = (level) => {
  return NESTED_BULLET_STYLES[level] || { marginLeft: `${level * 2}em` };
};