/**
 * Form definition from API (GET /public/forms/:form_type).
 * fields is an ordered array; each item is a single field or an array of fields (inline row). Max depth 2.
 */
export interface FormFieldDefinition {
  name: string;
  type: string;
  label: string;
  required?: boolean;
  placeholder?: string;
  /** For hidden fields, optional value to submit. */
  value?: string;
}

/** One item in the fields array: either a single field or a row of fields (inline). */
export type FormFieldItem = FormFieldDefinition | FormFieldDefinition[];

export interface FormDefinition {
  id: number;
  name: string;
  form_type: string;
  /** Ordered array; each element is a field or an array of fields (inline row). */
  fields: FormFieldItem[];
  settings?: Record<string, unknown>;
  /** Business name for consent copy (e.g. "{{company_name}}" in checkbox labels). */
  company_name?: string;
  created_at?: string;
  updated_at?: string;
}

export type FormType = 'lead' | 'job_application';
