/**
 * Postgres PGVector Store Node - Version 1.1 - Zod Schema
 * Discriminator: mode=retrieve
 *
 * Use .parse() for strict validation or .safeParse() for error handling.
 *
 * Schema helpers (z, expressionSchema, etc.) are passed as parameters
 * by the schema-validator, not imported from external files.
 *
 * @generated - CommonJS JavaScript for runtime loading
 */

module.exports = function getSchema({ parameters, z, expressionSchema, stringOrExpression, numberOrExpression, booleanOrExpression, resourceLocatorValueSchema, resourceMapperValueSchema, filterValueSchema, assignmentCollectionValueSchema, iDataObjectSchema, resolveSchema, embeddingInstanceSchema, rerankerInstanceSchema }) {

  // Helper function for conditional subnode schema
  function getSubnodesSchema() {
    return z.object({
      embedding: z.union([embeddingInstanceSchema, z.array(embeddingInstanceSchema)]),
      reranker: resolveSchema({ parameters, schema: rerankerInstanceSchema, required: true, displayOptions: {"show":{"useReranker":[true]}}, defaults: {"useReranker":false} }),
    }).strict();
  }

  return z.object({
    parameters: z.object({
      mode: z.literal('retrieve').default('retrieve'),
      tableName: stringOrExpression.optional(),
      useReranker: booleanOrExpression.optional(),
      options: z.object({ distanceStrategy: z.union([z.literal('cosine'), z.literal('innerProduct'), z.literal('euclidean'), expressionSchema]).optional(), collection: z.object({ values: z.object({ useCollection: booleanOrExpression.optional(), collectionName: stringOrExpression.optional(), collectionTableName: stringOrExpression.optional() }).optional() }).optional(), columnNames: z.object({ values: z.object({ idColumnName: stringOrExpression.optional(), vectorColumnName: stringOrExpression.optional(), contentColumnName: stringOrExpression.optional(), metadataColumnName: stringOrExpression.optional() }).optional() }).optional(), metadata: z.object({ metadataValues: z.array(z.object({ name: stringOrExpression.optional(), value: stringOrExpression.optional() })).optional() }).optional() }).optional(),
    }).optional(),
    subnodes: getSubnodesSchema(),
  });
};