export type PdfFormFieldType = 'text-line' | 'signature-line' | 'checkbox' | 'text-block' | 'spacer';

export interface PdfFormField {
  id: string;
  type: PdfFormFieldType;
  label: string;
  // text-line
  lineCount?: number;
  lineSpacing?: number;
  // checkbox
  options?: string[];
  columns?: number;
  // text-block
  content?: string;
  fontSize?: number;
  bold?: boolean;
  italic?: boolean;
  alignment?: 'left' | 'center' | 'right';
  // spacer
  height?: number;
  // signature-line
  showDate?: boolean;
  showPrintedName?: boolean;
}

export interface PdfFormTemplate {
  id?: string;
  association_id: string;
  name: string;
  description?: string;
  fields: PdfFormField[];
  page_settings: {
    margins: { top: number; bottom: number; left: number; right: number };
    orientation: 'portrait' | 'landscape';
  };
}

export const DEFAULT_PAGE_SETTINGS: PdfFormTemplate['page_settings'] = {
  margins: { top: 48, bottom: 48, left: 48, right: 48 },
  orientation: 'portrait',
};

export const FIELD_DEFAULTS: Record<PdfFormFieldType, Partial<PdfFormField>> = {
  'text-line': { label: 'Text Field', lineCount: 1, lineSpacing: 28 },
  'signature-line': { label: 'Signature', showDate: true, showPrintedName: true },
  'checkbox': { label: 'Checkbox Group', options: ['Option 1', 'Option 2'], columns: 1 },
  'text-block': { label: 'Text Block', content: 'Enter text here...', fontSize: 10, bold: false, italic: false, alignment: 'left' },
  'spacer': { label: 'Spacer', height: 20 },
};
