// This file is auto-generated by scripts/generate.js
import * as z from "zod/v4";
import * as validate from "./zod.gen.js";
function tagOf(value, key) {
    return typeof value === "object" && value !== null
        ? value[key]
        : undefined;
}
const zGuardCreateElicitationRequestForm = validate.zElicitationFormMode
    .and(z.object({ mode: z.literal("form") }))
    .and(z.object({ message: z.string() }));
const zGuardCreateElicitationRequestUrl = validate.zElicitationUrlMode
    .and(z.object({ mode: z.literal("url") }))
    .and(z.object({ message: z.string() }));
const zGuardCreateElicitationRequestCustom = z
    .union([validate.zElicitationSessionScope, validate.zElicitationRequestScope])
    .and(z.object({ message: z.string() }));
const zGuardElicitationPropertySchemaString = validate.zStringPropertySchema.and(z.object({ type: z.literal("string") }));
const zGuardElicitationPropertySchemaNumber = validate.zNumberPropertySchema.and(z.object({ type: z.literal("number") }));
const zGuardElicitationPropertySchemaInteger = validate.zIntegerPropertySchema.and(z.object({ type: z.literal("integer") }));
const zGuardElicitationPropertySchemaBoolean = validate.zBooleanPropertySchema.and(z.object({ type: z.literal("boolean") }));
const zGuardElicitationPropertySchemaArray = validate.zMultiSelectPropertySchema.and(z.object({ type: z.literal("array") }));
const zGuardMultiSelectItemsString = validate.zStringMultiSelectItems.and(z.object({ type: z.literal("string") }));
const zGuardMultiSelectItemsTitled = validate.zTitledMultiSelectItems;
const zGuardCreateElicitationResponseAccept = validate.zElicitationAcceptAction.and(z.object({ action: z.literal("accept") }));
const zGuardCreateElicitationResponseDecline = z.object({
    action: z.literal("decline"),
});
const zGuardCreateElicitationResponseCancel = z.object({
    action: z.literal("cancel"),
});
/**
 * Validated type guards for `CreateElicitationRequest`'s known variants.
 *
 * Each guard validates the variant's payload, not just its discriminant
 * tag: a malformed known variant (right tag, wrong payload) matches no
 * guard — mirroring wire validation, which rejects such values instead
 * of classifying them as custom.
 *
 * Guards check the value as given: fields that wire deserialization
 * salvages to a default (e.g. a malformed `_meta`) are only normalized
 * by parsing, and for ambiguous raw shapes (a known tag combined with
 * another variant's payload) guards are conservative where wire parsing
 * may still accept the value — narrow wire-parsed values when exact
 * parity matters.
 */
export const CreateElicitationRequest = {
    /** Narrow to the `form` variant, validating its payload. */
    isForm(value) {
        return (tagOf(value, "mode") === "form" &&
            zGuardCreateElicitationRequestForm.safeParse(value).success);
    },
    /** Narrow to the `url` variant, validating its payload. */
    isUrl(value) {
        return (tagOf(value, "mode") === "url" &&
            zGuardCreateElicitationRequestUrl.safeParse(value).success);
    },
    /**
     * Narrow to a custom or future variant: the `mode` tag matches no known variant, with a valid payload.
     *
     * TypeScript keeps the known variants in the narrowed union (they are
     * structural subtypes of the catch-all), so read vendor payload keys
     * via a widening cast: `(value as Record<string, unknown>).someKey`.
     */
    isCustom(value) {
        const tag = tagOf(value, "mode");
        return (typeof tag === "string" &&
            !["form", "url"].includes(tag) &&
            zGuardCreateElicitationRequestCustom.safeParse(value).success);
    },
};
/**
 * Validated type guards for `ElicitationPropertySchema`'s known variants.
 *
 * Each guard validates the variant's payload, not just its discriminant
 * tag: a malformed known variant (right tag, wrong payload) matches no
 * guard — mirroring wire validation, which rejects such values instead
 * of classifying them as custom.
 *
 * Guards check the value as given: fields that wire deserialization
 * salvages to a default (e.g. a malformed `_meta`) are only normalized
 * by parsing, and for ambiguous raw shapes (a known tag combined with
 * another variant's payload) guards are conservative where wire parsing
 * may still accept the value — narrow wire-parsed values when exact
 * parity matters.
 */
export const ElicitationPropertySchema = {
    /** Narrow to the `string` variant, validating its payload. */
    isString(value) {
        return (tagOf(value, "type") === "string" &&
            zGuardElicitationPropertySchemaString.safeParse(value).success);
    },
    /** Narrow to the `number` variant, validating its payload. */
    isNumber(value) {
        return (tagOf(value, "type") === "number" &&
            zGuardElicitationPropertySchemaNumber.safeParse(value).success);
    },
    /** Narrow to the `integer` variant, validating its payload. */
    isInteger(value) {
        return (tagOf(value, "type") === "integer" &&
            zGuardElicitationPropertySchemaInteger.safeParse(value).success);
    },
    /** Narrow to the `boolean` variant, validating its payload. */
    isBoolean(value) {
        return (tagOf(value, "type") === "boolean" &&
            zGuardElicitationPropertySchemaBoolean.safeParse(value).success);
    },
    /** Narrow to the `array` variant, validating its payload. */
    isArray(value) {
        return (tagOf(value, "type") === "array" &&
            zGuardElicitationPropertySchemaArray.safeParse(value).success);
    },
    /**
     * Narrow to a custom or future variant: the `type` tag matches no known variant.
     *
     * TypeScript keeps the known variants in the narrowed union (they are
     * structural subtypes of the catch-all), so read vendor payload keys
     * via a widening cast: `(value as Record<string, unknown>).someKey`.
     */
    isCustom(value) {
        const tag = tagOf(value, "type");
        return (typeof tag === "string" &&
            !["array", "boolean", "integer", "number", "string"].includes(tag));
    },
};
/**
 * Validated type guards for `MultiSelectItems`'s known variants.
 *
 * Each guard validates the variant's payload, not just its discriminant
 * tag: a malformed known variant (right tag, wrong payload) matches no
 * guard — mirroring wire validation, which rejects such values instead
 * of classifying them as custom.
 *
 * Guards check the value as given: fields that wire deserialization
 * salvages to a default (e.g. a malformed `_meta`) are only normalized
 * by parsing, and for ambiguous raw shapes (a known tag combined with
 * another variant's payload) guards are conservative where wire parsing
 * may still accept the value — narrow wire-parsed values when exact
 * parity matters.
 */
export const MultiSelectItems = {
    /** Narrow to the `string` variant, validating its payload. */
    isString(value) {
        return (tagOf(value, "type") === "string" &&
            zGuardMultiSelectItemsString.safeParse(value).success);
    },
    /** Narrow to the `titled` variant, validating its payload. */
    isTitled(value) {
        return (tagOf(value, "type") === undefined &&
            zGuardMultiSelectItemsTitled.safeParse(value).success);
    },
    /**
     * Narrow to a custom or future variant: the `type` tag matches no known variant.
     *
     * TypeScript keeps the known variants in the narrowed union (they are
     * structural subtypes of the catch-all), so read vendor payload keys
     * via a widening cast: `(value as Record<string, unknown>).someKey`.
     */
    isCustom(value) {
        const tag = tagOf(value, "type");
        return typeof tag === "string" && !["string"].includes(tag);
    },
};
/**
 * Validated type guards for `CreateElicitationResponse`'s known variants.
 *
 * Each guard validates the variant's payload, not just its discriminant
 * tag: a malformed known variant (right tag, wrong payload) matches no
 * guard — mirroring wire validation, which rejects such values instead
 * of classifying them as custom.
 *
 * Guards check the value as given: fields that wire deserialization
 * salvages to a default (e.g. a malformed `_meta`) are only normalized
 * by parsing, and for ambiguous raw shapes (a known tag combined with
 * another variant's payload) guards are conservative where wire parsing
 * may still accept the value — narrow wire-parsed values when exact
 * parity matters.
 */
export const CreateElicitationResponse = {
    /** Narrow to the `accept` variant, validating its payload. */
    isAccept(value) {
        return (tagOf(value, "action") === "accept" &&
            zGuardCreateElicitationResponseAccept.safeParse(value).success);
    },
    /** Narrow to the `decline` variant, validating its payload. */
    isDecline(value) {
        return (tagOf(value, "action") === "decline" &&
            zGuardCreateElicitationResponseDecline.safeParse(value).success);
    },
    /** Narrow to the `cancel` variant, validating its payload. */
    isCancel(value) {
        return (tagOf(value, "action") === "cancel" &&
            zGuardCreateElicitationResponseCancel.safeParse(value).success);
    },
    /**
     * Narrow to a custom or future variant: the `action` tag matches no known variant.
     *
     * TypeScript keeps the known variants in the narrowed union (they are
     * structural subtypes of the catch-all), so read vendor payload keys
     * via a widening cast: `(value as Record<string, unknown>).someKey`.
     */
    isCustom(value) {
        const tag = tagOf(value, "action");
        return (typeof tag === "string" && !["accept", "cancel", "decline"].includes(tag));
    },
};
//# sourceMappingURL=guards.gen.js.map