import { z } from "zod";
import { AppKeyPropertySchema, AppPropertySchema, ActionTypePropertySchema, ActionKeyPropertySchema, ActionPropertySchema, ConnectionIdPropertySchema, ConnectionPropertySchema, AuthenticationIdPropertySchema, InputsPropertySchema, } from "../../types/properties";
const GetActionInputFieldsSchemaDescription = "Get the JSON Schema representation of input fields for an action. Returns a JSON Schema object describing the structure, types, and validation rules for the action's input parameters.";
// Base schema for shared (optional) properties
const GetActionInputFieldsSchemaBaseSchema = 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 fetching the schema. Required if the action needs a connection to determine available fields.")
        .meta({ deprecated: true }),
    /** @deprecated Use connection instead */
    authenticationId: AuthenticationIdPropertySchema.nullable()
        .optional()
        .describe("Authentication ID to use when fetching the schema. Required if the action needs a connection to determine available fields.")
        .meta({ deprecated: true }),
    inputs: InputsPropertySchema.optional().describe("Current input values that may affect the schema (e.g., when fields depend on other field values)"),
});
// Schema for docs/registry (new param names only)
export const GetActionInputFieldsSchemaSchema = z
    .object({
    app: AppPropertySchema.describe("App key (e.g., 'SlackCLIAPI' or slug like 'github') to get the input schema for"),
    actionType: ActionTypePropertySchema.describe("Action type that matches the action's defined type"),
    action: ActionPropertySchema.describe("Action key to get the input schema for"),
})
    .merge(GetActionInputFieldsSchemaBaseSchema)
    .describe(GetActionInputFieldsSchemaDescription)
    .meta({
    aliases: {
        appKey: "app",
        actionKey: "action",
        connectionId: "connection",
        authenticationId: "connection",
    },
});
// Deprecated schema (backward compat)
const GetActionInputFieldsSchemaSchemaDeprecated = z
    .object({
    appKey: AppKeyPropertySchema.describe("App key (e.g., 'SlackCLIAPI' or slug like 'github') to get the input schema for"),
    actionType: ActionTypePropertySchema.describe("Action type that matches the action's defined type"),
    actionKey: ActionKeyPropertySchema.describe("Action key to get the input schema for"),
})
    .merge(GetActionInputFieldsSchemaBaseSchema);
// Union for runtime validation (accepts either new or old names)
export const GetActionInputFieldsSchemaInputSchema = z
    .union([
    GetActionInputFieldsSchemaSchema,
    GetActionInputFieldsSchemaSchemaDeprecated,
])
    .describe(GetActionInputFieldsSchemaDescription);
