import { z } from "zod";
import { linkSchema, customLinkSchema, entryLinkSchema, externalLinkSchema, internalLinkSchema, internalResolvedLinkSchema, internalRouteOnlyLinkSchema, pageLinkSchema } from "../../types/link";
import { type FieldDefinition } from "../schema";
export { linkSchema, customLinkSchema, entryLinkSchema, externalLinkSchema, internalLinkSchema, internalResolvedLinkSchema, internalRouteOnlyLinkSchema, pageLinkSchema, };
export type FieldPath = readonly (string | number)[];
export type FieldValidationMode = "strict" | "draft";
export type FieldValidationOptions = Readonly<{
    allowNull?: boolean;
    allowIncomplete?: boolean;
    mode?: FieldValidationMode;
}>;
export type NativeInputValidationProps = Readonly<{
    required?: boolean;
    maxLength?: number;
    min?: number;
    max?: number;
    step?: number;
    type?: "text" | "email" | "tel" | "url" | "number";
    inputMode?: "text" | "email" | "tel" | "url" | "numeric" | "decimal";
    pattern?: string;
}>;
type RequiredConstraint = Readonly<{
    kind: "required";
}>;
type TextTypeConstraint = Readonly<{
    kind: "textType";
}>;
type MaxLengthConstraint = Readonly<{
    kind: "maxLength";
    maximum: number;
}>;
type EmailFormatConstraint = Readonly<{
    kind: "emailFormat";
}>;
type PhoneFormatConstraint = Readonly<{
    kind: "phoneFormat";
}>;
type PatternFormatConstraint = Readonly<{
    kind: "patternFormat";
    pattern: string;
}>;
type UrlFormatConstraint = Readonly<{
    kind: "urlFormat";
    allowRelative: boolean;
}>;
type NumberTypeConstraint = Readonly<{
    kind: "numberType";
}>;
type NumberMinConstraint = Readonly<{
    kind: "numberMin";
    minimum: number;
}>;
type NumberMaxConstraint = Readonly<{
    kind: "numberMax";
    maximum: number;
}>;
type SlugFormatConstraint = Readonly<{
    kind: "slugFormat";
}>;
type SelectOptionConstraint = Readonly<{
    kind: "selectOption";
    source: SelectConstraintSource;
    multiple: boolean;
}>;
type ArrayTypeConstraint = Readonly<{
    kind: "arrayType";
}>;
type MinItemsConstraint = Readonly<{
    kind: "minItems";
    minimum: number;
}>;
type MaxItemsConstraint = Readonly<{
    kind: "maxItems";
    maximum: number;
}>;
type RichTextDocConstraint = Readonly<{
    kind: "richTextDoc";
}>;
type MediaObjectConstraint = Readonly<{
    kind: "mediaObject";
}>;
type LinkObjectConstraint = Readonly<{
    kind: "linkObject";
}>;
type ReferenceTextConstraint = Readonly<{
    kind: "referenceText";
}>;
type StringConstraint = RequiredConstraint | TextTypeConstraint | MaxLengthConstraint | EmailFormatConstraint | PhoneFormatConstraint | PatternFormatConstraint | UrlFormatConstraint | SlugFormatConstraint | ReferenceTextConstraint;
type NumberConstraint = RequiredConstraint | NumberTypeConstraint | NumberMinConstraint | NumberMaxConstraint;
type SelectConstraint = RequiredConstraint | SelectOptionConstraint;
type ArrayConstraint = RequiredConstraint | ArrayTypeConstraint | MinItemsConstraint | MaxItemsConstraint;
type ObjectConstraint = RequiredConstraint | RichTextDocConstraint | MediaObjectConstraint | LinkObjectConstraint;
type BooleanConstraint = RequiredConstraint;
export type FieldConstraint = StringConstraint | NumberConstraint | SelectConstraint | ArrayConstraint | ObjectConstraint | BooleanConstraint;
export type SelectConstraintSource = Readonly<{
    kind: "static";
    values: readonly string[];
}> | Readonly<{
    kind: "runtime";
    source: "site" | "sdk";
}>;
export type FieldValidationIssue = BaseIssue<"required", {
    emptyOrigin?: "string" | "array";
}> | BaseIssue<"wrongType", {
    expected: string;
}> | BaseIssue<"tooLong", {
    maximum: number;
}> | BaseIssue<"invalidEmail"> | BaseIssue<"invalidPhone"> | BaseIssue<"invalidPattern"> | BaseIssue<"invalidUrl"> | BaseIssue<"invalidNumber"> | BaseIssue<"tooSmall", {
    minimum: number;
}> | BaseIssue<"tooLarge", {
    maximum: number;
}> | BaseIssue<"invalidSlug"> | BaseIssue<"invalidOption"> | BaseIssue<"tooFewItems", {
    minimum: number;
    itemLabel: string;
}> | BaseIssue<"tooManyItems", {
    maximum: number;
    itemLabel: string;
}> | BaseIssue<"invalidRichText"> | BaseIssue<"invalidMedia"> | BaseIssue<"invalidLink"> | BaseIssue<"invalidReference">;
type BaseIssue<K extends string, Extra extends object = Record<never, never>> = Readonly<{
    kind: K;
    path: FieldPath;
    fieldId: string;
    label: string;
}> & Readonly<Extra>;
type PlanBase<K extends string, ValueKind extends string, Constraints extends FieldConstraint> = Readonly<{
    kind: K;
    valueKind: ValueKind;
    fieldId: string;
    label: string;
    fieldType: FieldDefinition["type"];
    path: FieldPath;
    required: boolean;
    constraints: readonly Constraints[];
}>;
export type StringFieldValidationPlan = PlanBase<"string", "string", StringConstraint> & Readonly<{
    fieldType: "text" | "slug" | "url" | "reference" | "date" | "time" | "datetime";
}>;
export type NumberFieldValidationPlan = PlanBase<"number", "number", NumberConstraint> & Readonly<{
    fieldType: "number" | "text";
}>;
export type BooleanFieldValidationPlan = PlanBase<"boolean", "boolean", BooleanConstraint> & Readonly<{
    fieldType: "boolean";
}>;
export type RichTextFieldValidationPlan = PlanBase<"richText", "object", ObjectConstraint> & Readonly<{
    fieldType: "richText";
}>;
export type MediaFieldValidationPlan = PlanBase<"media", "object", ObjectConstraint> & Readonly<{
    fieldType: "media";
}>;
export type LinkFieldValidationPlan = PlanBase<"link", "object", ObjectConstraint> & Readonly<{
    fieldType: "link";
}>;
export type SelectFieldValidationPlan = PlanBase<"select", "select", SelectConstraint> & Readonly<{
    fieldType: "select";
}>;
export type RepeaterFieldValidationPlan = PlanBase<"repeater", "array", ArrayConstraint> & Readonly<{
    fieldType: "repeater";
    repeatedItemPlan?: readonly FieldValidationPlan[];
    repeatedItemVariants?: readonly RepeatedItemValidationPlan[];
}>;
export type GroupFieldValidationPlan = PlanBase<"group", "object", ObjectConstraint> & Readonly<{
    fieldType: "group" | "modal" | "tabGroup";
    children: readonly FieldValidationPlan[];
    allowNullChildren?: boolean;
}>;
export type PassthroughFieldValidationPlan = PlanBase<"passthrough", "unknown", RequiredConstraint> & Readonly<{
    fieldType: "presetOrCustom" | "contentTypeSelect" | "entryPicker";
}>;
export type FieldValidationPlan = StringFieldValidationPlan | NumberFieldValidationPlan | BooleanFieldValidationPlan | RichTextFieldValidationPlan | MediaFieldValidationPlan | LinkFieldValidationPlan | SelectFieldValidationPlan | RepeaterFieldValidationPlan | GroupFieldValidationPlan | PassthroughFieldValidationPlan;
export type RepeatedItemValidationPlan = Readonly<{
    typeId: string;
    fields: readonly FieldValidationPlan[];
}>;
export declare function formatFieldPath(path: FieldPath): string;
export declare function toZodIssuePath(path: FieldPath): (string | number)[];
export declare function parseFieldPathKey(key: string): FieldPath;
export declare function fieldIssueToMessage(issue: FieldValidationIssue): string;
export declare function deriveFieldValidationPlan(field: FieldDefinition, path?: FieldPath): FieldValidationPlan;
export declare function fieldPlanToNativeInputProps(plan: FieldValidationPlan): NativeInputValidationProps;
export declare function normalizeFieldInput(plan: FieldValidationPlan, value: unknown, options?: FieldValidationOptions): unknown;
export declare function validateFieldValue(plan: FieldValidationPlan, value: unknown, options?: FieldValidationOptions): FieldValidationIssue[];
export declare function fieldPlanToZod(plan: FieldValidationPlan, options?: FieldValidationOptions): z.ZodTypeAny;
export declare function validateManifestValues(fields: readonly FieldDefinition[], values: Record<string, unknown>, options?: FieldValidationOptions): FieldValidationIssue[];
export declare function isEmptyValue(value: unknown): boolean;
export declare function isEmptyRichTextDoc(value: unknown): boolean;
