/**
 * Field Constants
 *
 * Shared field type constants used across the application.
 * Centralised here so the list is defined once and imported wherever needed
 * (form builder, integrations, entry manager, etc.).
 */

/**
 * Field types that are used for bot/spam protection.
 * These fields should be excluded from stored entries, integration payloads,
 * placeholder lists, and any other processing that targets user-submitted data.
 */
export const SECURITY_FIELD_TYPES = ['recaptcha', 'turnstile', 'hcaptcha'] as const

export type SecurityFieldType = (typeof SECURITY_FIELD_TYPES)[number]

/**
 * Returns true when the given field type is a security/CAPTCHA field.
 *
 * @example
 * isSecurityField('recaptcha') // true
 * isSecurityField('email')     // false
 */
export const isSecurityField = (fieldType: string): boolean =>
  (SECURITY_FIELD_TYPES as readonly string[]).includes(fieldType)
