'use strict';

const z = require('zod');

const listContentQuerySchema = z.z.object({
  slug: z.z.string().optional(),
  limit: z.z.coerce.number().min(1).max(100).optional().default(20),
  offset: z.z.coerce.number().min(0).optional().default(0)
});
z.z.object({
  slug: z.z.string().min(1, "Slug is required"),
  // Use passthrough object instead of z.record(z.unknown()) due to Zod v4 bug
  data: z.z.object({}).passthrough()
});
z.z.object({
  slug: z.z.string().min(1, "Slug is required").optional(),
  // Use passthrough object instead of z.record(z.unknown()) due to Zod v4 bug
  data: z.z.object({}).passthrough().optional()
});
const contentTypeResponseSchema = z.z.object({
  id: z.z.string(),
  name: z.z.string(),
  slug: z.z.string(),
  description: z.z.string().nullable().optional(),
  jsonSchema: z.z.string(),
  createdAt: z.z.string(),
  updatedAt: z.z.string()
});
const contentItemResponseSchema = z.z.object({
  id: z.z.string(),
  contentTypeId: z.z.string(),
  slug: z.z.string(),
  data: z.z.string(),
  authorId: z.z.string().nullable().optional(),
  createdAt: z.z.string(),
  updatedAt: z.z.string()
});
const contentItemWithDataResponseSchema = contentItemResponseSchema.extend({
  // Use passthrough object instead of z.record(z.unknown()) due to Zod v4 bug
  parsedData: z.z.object({}).passthrough(),
  contentType: contentTypeResponseSchema.optional()
});
z.z.object({
  items: z.z.array(contentItemWithDataResponseSchema),
  total: z.z.number(),
  limit: z.z.number(),
  offset: z.z.number()
});

exports.contentItemResponseSchema = contentItemResponseSchema;
exports.contentItemWithDataResponseSchema = contentItemWithDataResponseSchema;
exports.contentTypeResponseSchema = contentTypeResponseSchema;
exports.listContentQuerySchema = listContentQuerySchema;
