/**
 * Forms domain contracts.
 *
 * These types are the single source of truth shared across the data layer,
 * the REST API, the admin UI service client, and the public form renderer.
 * They intentionally mirror the persisted shapes (Prisma `FormSubmission`,
 * `FormSchemaVersion`, `FormSubmissionFile`, `FormWebhook`) plus the form
 * definition that lives as a typed `forms` document.
 *
 * Storage split:
 *   - Form *definitions* live in `actuate_documents` (collection `forms`); the
 *     `FormDefinition` shape below is the parsed view of `document.data`.
 *   - Field *schema* is versioned in `actuate_form_schema_versions`.
 *   - *Submissions* live in `actuate_form_submissions` and reference the schema
 *     version they were captured against (`schemaVersionId`).
 */
export type FormFieldType = 'text' | 'email' | 'phone' | 'textarea' | 'select' | 'multiselect' | 'radio' | 'checkbox' | 'date' | 'number' | 'url' | 'hidden' | 'file' | 'consent' | 'richtext' | 'divider' | 'honeypot';
/** Field types that capture user input (excludes display-only/system fields). */
export declare const INPUT_FIELD_TYPES: readonly FormFieldType[];
/** Field types that never produce a stored value. */
export declare const NON_INPUT_FIELD_TYPES: readonly FormFieldType[];
/** PII sensitivity classification used for masking, encryption, and export gating. */
export type PiiClassification = 'none' | 'low' | 'medium' | 'high';
/** A single selectable option for select/multiselect/radio fields. */
export interface FormFieldOption {
    label: string;
    value: string;
}
/** Declarative, server-enforceable validation for a field. */
export interface FieldValidationRules {
    required?: boolean;
    minLength?: number;
    maxLength?: number;
    pattern?: string;
    /** Built-in format validators layered on top of `type`. */
    format?: 'email' | 'phone' | 'url';
    min?: number;
    max?: number;
    /** Allowed MIME types for file fields. */
    fileTypes?: string[];
    /** Max upload size in megabytes for file fields. */
    maxFileSizeMB?: number;
    /** Named server-side hook to run for custom validation (resolved by config). */
    customValidator?: string;
}
export type ConditionalOperator = 'equals' | 'notEquals' | 'contains' | 'isEmpty' | 'isNotEmpty';
/** Show/hide or require-when rules driven by another field's value. */
export interface ConditionalRule {
    fieldKey: string;
    operator: ConditionalOperator;
    value?: string;
}
export interface ConditionalLogic {
    show?: ConditionalRule[];
    require?: ConditionalRule[];
}
export type FieldWidth = 'full' | 'half' | 'third';
export interface FormField {
    id: string;
    label: string;
    key: string;
    type: FormFieldType;
    required: boolean;
    placeholder?: string;
    helpText?: string;
    defaultValue?: string | number | boolean | string[] | null;
    options?: FormFieldOption[];
    validationRules?: FieldValidationRules;
    conditionalLogic?: ConditionalLogic;
    sortOrder: number;
    width?: FieldWidth;
    piiClassification?: PiiClassification;
    encrypted?: boolean;
}
export interface FormSchemaVersion {
    id: string;
    formId: string;
    version: number;
    fields: FormField[];
    notes?: string | null;
    createdById?: string | null;
    createdAt: string;
}
export interface FormWebhookConfig {
    id: string;
    formId: string;
    url: string;
    /** Present in admin responses only when the caller may view secrets. */
    secret?: string;
    enabled: boolean;
    events: FormWebhookEvent[];
    retryCount: number;
    lastDeliveryAt?: string | null;
    lastDeliveryStatus?: string | null;
    createdAt: string;
    updatedAt: string;
}
export type FormWebhookEvent = 'form.submitted' | 'form.entry.starred' | 'form.entry.archived' | 'form.spam_detected';
export interface FormNotificationSettings {
    enabled: boolean;
    recipients: string[];
    replyToFieldKey?: string | null;
    subjectTemplate?: string;
    messageTemplate?: string;
    includeFields?: boolean;
    excludeSensitiveFields?: boolean;
    autoresponderEnabled?: boolean;
    autoresponderEmailFieldKey?: string | null;
    autoresponderSubject?: string;
    autoresponderBody?: string;
    webhookEnabled?: boolean;
}
export type SpamProtectionStrategy = 'honeypot' | 'timeToSubmit' | 'rateLimit' | 'captcha' | 'domainAllowlist' | 'blocklist' | 'keyword' | 'aiClassifier';
export interface FormSpamSettings {
    strategies?: SpamProtectionStrategy[];
    honeypotFieldKey?: string;
    /** Minimum seconds between render and submit; faster is treated as a bot. */
    minSubmitSeconds?: number;
    allowedDomains?: string[];
    blockedEmails?: string[];
    blockedDomains?: string[];
    blockedKeywords?: string[];
}
export interface FormEmbedSettings {
    /** Origins allowed to host the embedded form (empty = any). */
    allowedDomains?: string[];
    embedToken?: string | null;
}
export type FormStatus = 'active' | 'draft' | 'archived';
export interface FormDefinition {
    id: string;
    name: string;
    slug: string;
    description?: string;
    status: FormStatus;
    activeSchemaVersionId?: string | null;
    fields: FormField[];
    notificationSettings?: FormNotificationSettings;
    embedSettings?: FormEmbedSettings;
    spamSettings?: FormSpamSettings;
    successMessage?: string;
    redirectUrl?: string;
    /** Aggregate counters surfaced in the list/sidebar (computed by services). */
    totalEntries?: number;
    unreadEntries?: number;
    starredEntries?: number;
    lastEntryAt?: string | null;
    notifyEnabled?: boolean;
    createdBy?: string;
    createdAt?: string;
    updatedAt?: string;
    archivedAt?: string | null;
}
export type SpamStatus = 'clean' | 'suspected' | 'spam';
export interface FormSubmissionFile {
    id: string;
    submissionId: string;
    fieldKey: string;
    mediaAssetId?: string | null;
    fileName: string;
    mimeType: string;
    sizeBytes: number;
    storageKey: string;
    publicUrl?: string | null;
    secureDownloadUrl?: string | null;
    createdAt: string;
}
export interface FormSubmission {
    id: string;
    entryNumber?: number | null;
    formId: string;
    formName?: string;
    formSlug?: string;
    schemaVersionId?: string | null;
    data: Record<string, unknown>;
    normalizedData?: Record<string, unknown> | null;
    senderName?: string | null;
    senderEmail?: string | null;
    senderPhone?: string | null;
    preview?: string | null;
    unread: boolean;
    starred: boolean;
    archived: boolean;
    spamStatus: SpamStatus;
    ipAddressHash?: string | null;
    userAgent?: string | null;
    referrer?: string | null;
    pageUrl?: string | null;
    utmSource?: string | null;
    utmMedium?: string | null;
    utmCampaign?: string | null;
    submittedAt: string;
    readAt?: string | null;
    archivedAt?: string | null;
    createdAt: string;
    updatedAt: string;
    files?: FormSubmissionFile[];
}
export interface FetchFormsParams {
    search?: string;
    status?: FormStatus;
    notifyEnabled?: boolean;
    sortBy?: string;
    sortDirection?: 'asc' | 'desc';
    page?: number;
    pageSize?: number;
}
export interface FetchFormEntriesParams {
    search?: string;
    formId?: string;
    unread?: boolean;
    starred?: boolean;
    archived?: boolean;
    spamStatus?: SpamStatus;
    dateFrom?: string;
    dateTo?: string;
    thisWeek?: boolean;
    sortBy?: string;
    sortDirection?: 'asc' | 'desc';
    page?: number;
    pageSize?: number;
}
export interface FormStats {
    totalForms: number;
    activeForms: number;
    totalEntries: number;
    unreadEntries: number;
}
/** A sidebar nav entry with its dynamic unread count. */
export interface FormsSidebarCount {
    formId: string;
    name: string;
    slug: string;
    status: FormStatus;
    unread: number;
}
export interface EntryCounts {
    total: number;
    unread: number;
    starred: number;
    thisWeek: number;
    byForm: Record<string, number>;
}
//# sourceMappingURL=types.d.ts.map