import { z } from 'zod';

/**
 * XState-inspired State Machine Protocol
 * Used to define strict business logic constraints and lifecycle management.
 * Prevent AI "hallucinations" by enforcing valid valid transitions.
 */
/**
 * References a named action (side effect)
 * Can be a script, a webhook, or a field update.
 */
declare const ActionRefSchema: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
    type: z.ZodString;
    params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
}, z.core.$strip>]>;
/**
 * References a named condition (guard)
 * Must evaluate to true for the transition to occur.
 */
declare const GuardRefSchema: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
    type: z.ZodString;
    params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
}, z.core.$strip>]>;
/**
 * State Transition Definition
 * "When EVENT happens, if GUARD is true, go to TARGET and run ACTIONS"
 */
declare const TransitionSchema: z.ZodObject<{
    target: z.ZodOptional<z.ZodString>;
    cond: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
        type: z.ZodString;
        params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
    }, z.core.$strip>]>>;
    actions: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
        type: z.ZodString;
        params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
    }, z.core.$strip>]>>>;
    description: z.ZodOptional<z.ZodString>;
}, z.core.$strip>;
/**
 * Event Definition (Signals)
 */
declare const EventSchema: z.ZodObject<{
    type: z.ZodString;
    schema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
}, z.core.$strip>;
type ActionRef = z.infer<typeof ActionRefSchema>;
type Transition = z.infer<typeof TransitionSchema>;
type StateNodeConfig = {
    type?: 'atomic' | 'compound' | 'parallel' | 'final' | 'history';
    entry?: ActionRef[];
    exit?: ActionRef[];
    on?: Record<string, string | Transition | Transition[]>;
    always?: Transition[];
    initial?: string;
    states?: Record<string, StateNodeConfig>;
    meta?: {
        label?: string;
        description?: string;
        color?: string;
        aiInstructions?: string;
    };
};
/**
 * State Node Definition
 */
declare const StateNodeSchema: z.ZodType<StateNodeConfig>;
/**
 * Top-Level State Machine Definition
 */
declare const StateMachineSchema: z.ZodObject<{
    id: z.ZodString;
    description: z.ZodOptional<z.ZodString>;
    contextSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
    initial: z.ZodString;
    states: z.ZodRecord<z.ZodString, z.ZodType<StateNodeConfig, unknown, z.core.$ZodTypeInternals<StateNodeConfig, unknown>>>;
    on: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
        target: z.ZodOptional<z.ZodString>;
        cond: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
            type: z.ZodString;
            params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
        }, z.core.$strip>]>>;
        actions: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
            type: z.ZodString;
            params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
        }, z.core.$strip>]>>>;
        description: z.ZodOptional<z.ZodString>;
    }, z.core.$strip>, z.ZodArray<z.ZodObject<{
        target: z.ZodOptional<z.ZodString>;
        cond: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
            type: z.ZodString;
            params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
        }, z.core.$strip>]>>;
        actions: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
            type: z.ZodString;
            params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
        }, z.core.$strip>]>>>;
        description: z.ZodOptional<z.ZodString>;
    }, z.core.$strip>>]>>>;
}, z.core.$strip>;
type StateMachineConfig = z.infer<typeof StateMachineSchema>;

export { type ActionRef as A, EventSchema as E, GuardRefSchema as G, type StateNodeConfig as S, type Transition as T, ActionRefSchema as a, type StateMachineConfig as b, StateMachineSchema as c, StateNodeSchema as d, TransitionSchema as e };
