import { _ as getInputType, a as DocumentMediaInjectionPlacementSchema, b as ProviderEnvOverridesSchema, c as DocxInjectionPlacementValues, d as InputDefinitionSchema, f as InputTypeSchema, g as getInputDescription, h as buildInputPromptDescription, i as CompletionTokenDetailsSchema, l as InputConfigSchema, m as InputsSchema, n as PromptSchema, o as DocumentMediaInjectionPlacementValues, p as InputTypeValues, r as BaseTokenUsageSchema, s as DocxInjectionPlacementSchema, t as PromptConfigSchema, u as InputDefinitionObjectSchema, v as normalizeInputDefinition, y as normalizeInputs } from "./prompts-GW61BoS0.js";
import { n as hasFunctionToolCallValidator, t as isTransformFunction } from "./transform-BMgWWReY.js";
import { n as StringOrFunctionSchema, t as NunjucksFilterMapSchema } from "./shared-pMqfv2Z7.js";
import { z } from "zod";
//#region src/contracts/api/common.ts
/** Standard email validation schema. */
const EmailSchema = z.string().email();
/**
* Response containing only a `message` field. Closed shape - extra properties are stripped.
* For responses that may carry endpoint-specific metadata, use `SuccessResponseSchema` (passthrough).
*/
const MessageResponseSchema = z.object({ message: z.string() });
/** Response containing a success flag and optional message. */
const SuccessResponseSchema = z.object({
	success: z.boolean(),
	message: z.string().optional()
}).passthrough();
/** Shared API error shape. Routes may add endpoint-specific fields. */
const ErrorResponseSchema = z.object({
	error: z.string(),
	details: z.unknown().optional(),
	suggestion: z.string().optional(),
	success: z.literal(false).optional()
}).passthrough();
/**
* Express query strings arrive as `string | undefined`. This schema treats only the literal
* string `'true'` (or boolean `true`) as truthy; every other value - including `'1'`, `'yes'`,
* and `undefined` - resolves to `false`. Tests that depend on tri-state semantics should use
* a different schema.
*/
const BooleanQueryParamSchema = z.union([z.boolean(), z.string()]).optional().transform((value) => value === true || value === "true");
/** Generic object payload for endpoints with intentionally open data. */
const JsonObjectSchema = z.record(z.string(), z.unknown());
/** Timestamp that can be either an ISO string or Unix epoch number. */
const TimestampSchema = z.union([z.string(), z.number()]);
//#endregion
//#region src/contracts/api/user.ts
/** Email status values returned by the server. */
const EmailStatusEnum = z.enum([
	"ok",
	"exceeded_limit",
	"show_usage_warning",
	"email_verification_required",
	"no_email",
	"risky_email",
	"disposable_email"
]);
const GetUserResponseSchema = z.object({ email: EmailSchema.nullable() });
const GetUserIdResponseSchema = z.object({ id: z.string() });
const UpdateUserRequestSchema = z.object({ email: EmailSchema });
const UpdateUserResponseSchema = z.object({
	success: z.boolean(),
	message: z.string()
});
const ClearUserEmailResponseSchema = UpdateUserResponseSchema;
const EmailStatusValidateQueryParamSchema = z.unknown().optional().transform((value) => value === true || value === "true");
const GetEmailStatusQuerySchema = z.object({ validate: EmailStatusValidateQueryParamSchema });
const GetEmailStatusResponseSchema = z.object({
	hasEmail: z.boolean(),
	email: EmailSchema.optional(),
	status: EmailStatusEnum,
	message: z.string().optional()
});
/** Request body for API key authentication. */
const LoginRequestSchema = z.object({
	apiKey: z.string().min(1, "API key is required").max(512, "API key too long"),
	apiHost: z.url().optional()
});
/** Response from successful login. */
const LoginResponseSchema = z.object({
	success: z.literal(true),
	user: z.object({
		id: z.string(),
		name: z.string(),
		email: EmailSchema
	}),
	organization: z.object({
		id: z.string(),
		name: z.string()
	}),
	app: z.object({ url: z.string() })
});
/** Response from logout endpoint. */
const LogoutResponseSchema = z.object({
	success: z.literal(true),
	message: z.string()
});
/** Response from cloud config endpoint. */
const CloudConfigResponseSchema = z.object({
	appUrl: z.string(),
	isEnabled: z.boolean()
});
/** Grouped schemas for server-side validation. */
const UserSchemas = {
	Get: { Response: GetUserResponseSchema },
	GetId: { Response: GetUserIdResponseSchema },
	Update: {
		Request: UpdateUserRequestSchema,
		Response: UpdateUserResponseSchema
	},
	ClearEmail: { Response: ClearUserEmailResponseSchema },
	EmailStatus: {
		Query: GetEmailStatusQuerySchema,
		Response: GetEmailStatusResponseSchema
	},
	Login: {
		Request: LoginRequestSchema,
		Response: LoginResponseSchema
	},
	Logout: { Response: LogoutResponseSchema },
	CloudConfig: { Response: CloudConfigResponseSchema }
};
//#endregion
export { BaseTokenUsageSchema, BooleanQueryParamSchema, ClearUserEmailResponseSchema, CloudConfigResponseSchema, CompletionTokenDetailsSchema, DocumentMediaInjectionPlacementSchema, DocumentMediaInjectionPlacementValues, DocxInjectionPlacementSchema, DocxInjectionPlacementValues, EmailSchema, EmailStatusEnum, ErrorResponseSchema, GetEmailStatusQuerySchema, GetEmailStatusResponseSchema, GetUserIdResponseSchema, GetUserResponseSchema, InputConfigSchema, InputDefinitionObjectSchema, InputDefinitionSchema, InputTypeSchema, InputTypeValues, InputsSchema, JsonObjectSchema, LoginRequestSchema, LoginResponseSchema, LogoutResponseSchema, MessageResponseSchema, NunjucksFilterMapSchema, PromptConfigSchema, PromptSchema, ProviderEnvOverridesSchema, StringOrFunctionSchema, SuccessResponseSchema, TimestampSchema, UpdateUserRequestSchema, UpdateUserResponseSchema, UserSchemas, buildInputPromptDescription, getInputDescription, getInputType, hasFunctionToolCallValidator, isTransformFunction, normalizeInputDefinition, normalizeInputs };

//# sourceMappingURL=contracts.js.map