import { z } from "zod";
import { AppKeyPropertySchema, AppPropertySchema, ActionTypePropertySchema, ActionKeyPropertySchema, ActionPropertySchema, ConnectionIdPropertySchema, ConnectionPropertySchema, AuthenticationIdPropertySchema, InputsPropertySchema, } from "../../types/properties";
const ListInputFieldsDescription = "Get the input fields required for a specific action";
// Base schema for shared (optional) properties
const ListActionInputFieldsBaseSchema = z.object({
    connection: ConnectionPropertySchema.optional().describe("Connection alias or connection ID (UUID or positive integer). Strings that match a key in the connections map are resolved against it; otherwise the value is used as a connection ID directly. Mutually exclusive with connectionId."),
    connectionId: ConnectionIdPropertySchema.nullable()
        .optional()
        .describe("Connection ID to use when listing input fields. Required if the action needs a connection to determine available fields.")
        .meta({ deprecated: true }),
    /** @deprecated Use connection instead */
    authenticationId: AuthenticationIdPropertySchema.nullable()
        .optional()
        .meta({ deprecated: true }),
    inputs: InputsPropertySchema.optional().describe("Current input values that may affect available fields"),
    pageSize: z
        .number()
        .min(1)
        .optional()
        .describe("Number of input fields per page"),
    maxItems: z
        .number()
        .min(1)
        .optional()
        .describe("Maximum total items to return across all pages"),
    cursor: z.string().optional().describe("Cursor to start from"),
});
// Schema for docs/registry (new param names only)
export const ListActionInputFieldsSchema = z
    .object({
    app: AppPropertySchema,
    actionType: ActionTypePropertySchema,
    action: ActionPropertySchema,
})
    .merge(ListActionInputFieldsBaseSchema)
    .describe(ListInputFieldsDescription)
    .meta({
    aliases: {
        appKey: "app",
        actionKey: "action",
        connectionId: "connection",
        authenticationId: "connection",
    },
});
// Deprecated schema (backward compat)
const ListActionInputFieldsSchemaDeprecated = z
    .object({
    appKey: AppKeyPropertySchema,
    actionType: ActionTypePropertySchema,
    actionKey: ActionKeyPropertySchema,
})
    .merge(ListActionInputFieldsBaseSchema);
// Union for runtime validation (accepts either new or old names)
export const ListActionInputFieldsInputSchema = z
    .union([ListActionInputFieldsSchema, ListActionInputFieldsSchemaDeprecated])
    .describe(ListInputFieldsDescription);
