import { CFConfig, CFProps, CFResponse, CustomFieldAiConfig, CustomFieldAiFormatResponse, CustomFieldErrorItem, CustomFieldGuidanceConfig, CustomFieldValidateResponse, FieldRelationRefTarget, FieldRelationValidationInput, FieldTypes, GetIndexDefinitionProps, GetSchemaDefinitionProps, IndexDefinition, SchemaDefinition } from "./types.mjs";
import { LucidBricksTable, Select } from "../../db/types.mjs";
import { ServiceResponse } from "../../../utils/services/types.mjs";
//#region src/libs/collection/custom-fields/custom-field.d.ts
declare abstract class CustomField<T extends FieldTypes> {
  /** Tree-table parent key when this field belongs to a nested tree scope. */
  treeParent: string | null;
  /** Tab parent key used to control admin field grouping. */
  tabParent: string | null;
  /**
   * Structural parent key when this field sits directly inside a
   * section/collapsible. Structural parents only affect UI nesting and client
   * response shaping - storage is unaffected.
   */
  structuralParent: string | null;
  abstract type: T;
  abstract key: string;
  abstract props?: CFProps<T>;
  abstract config: CFConfig<T>;
  /**
   * Field-level switches for shared validation phases.
   * Override in subclasses when a field should skip a shared phase.
   */
  protected get sharedValidationFlags(): {
    skipValidation: boolean;
    skipRequiredValidation: boolean;
    skipZodValidation: boolean;
  };
  /** Whether this field type supports Lucid AI features. */
  get supportsAi(): boolean;
  /** Default guidance presets for fields that support Lucid AI features. */
  protected get defaultAiGuidance(): CustomFieldGuidanceConfig[];
  /** Normalized field metadata used by Lucid AI features. */
  get aiConfig(): CustomFieldAiConfig;
  /** JSON schema for AI generated values, when a field supports generation. */
  get jsonSchema(): Record<string, unknown> | null;
  /** Public field display metadata. */
  get details(): CFConfig<T>["details"];
  /** Normalizes input values before validation and persistence. */
  normalizeInputValue(value: unknown): unknown;
  /** Formats a single AI-generated locale value before it is returned. */
  formatAiGeneratedValue(value: unknown): CustomFieldAiFormatResponse;
  /** Whether this field should be processed with localization translations. */
  get localizedEnabled(): boolean;
  /** Default fallback value used while normalizing missing field input. */
  get defaultValue(): unknown;
  /** Shared error builders used by `validate*` checks. */
  get errors(): {
    fieldType: CustomFieldErrorItem;
    required: CustomFieldErrorItem;
    zod: CustomFieldErrorItem;
  };
  /**
   * Defines DB schema fragments for this field.
   *
   * If the foreign key references another custom field key, use
   * `prefixGeneratedColName(key)` for the referenced column.
   */
  abstract getSchemaDefinition(props: GetSchemaDefinitionProps): Awaited<ServiceResponse<SchemaDefinition>>;
  /** Defines generated indexes for this field's schema fragments. */
  getIndexDefinitions(props: GetIndexDefinitionProps): IndexDefinition[];
  /** Formats raw DB values into API response values for this field. */
  abstract formatResponseValue(value: unknown): CFResponse<T>["value"];
  /** Serializes field values into relation-table row payloads when needed. */
  serializeRelationFieldValue(_value: unknown): Array<Record<string, unknown>>;
  /**
   * Returns the unprefixed column name that stores this field's relation ID value
   * inside a relation-table row.
   */
  get relationValueColumn(): string | null;
  /**
   * Extracts a single field value item from a relation-table row.
   */
  extractRelationFieldValue(row: Select<LucidBricksTable>): unknown | null;
  /**
   * Returns relation field values grouped for shared validation fetches.
   */
  getRelationFieldValidationInput(value: unknown): FieldRelationValidationInput;
  /**
   * Returns any relation field ref targets that cannot be derived from schema
   * foreign keys.
   */
  getRelationFieldRefTargets(_row: Select<LucidBricksTable>): FieldRelationRefTarget[];
  /** Runs field-specific validation once shared checks have passed. */
  abstract uniqueValidation(value: unknown, refData?: unknown): CustomFieldValidateResponse;
  /** Runs shared validation and then delegates to `uniqueValidation`. */
  validate(props: {
    type: FieldTypes;
    value: unknown;
    refData?: unknown;
  }): CustomFieldValidateResponse;
  /** Validates that the submitted field type matches this instance type. */
  private validateFieldType;
  /** Applies shared required checks where supported. */
  private validateRequired;
  /** Applies optional zod checks when the field exposes a zod validator. */
  private validateZodConstraint;
}
//#endregion
export { CustomField as default };
//# sourceMappingURL=custom-field.d.mts.map