import { z } from 'zod';
import { mongodbConfigSchema } from './mongodb.schema';
import { postgresConfigSchema } from './postgres.schema';
import { questdbConfigSchema } from './questdb.schema';
import { redisConfigSchema } from './redis.schema';
import { browserConfigSchema, proxyConfigSchema, queueConfigSchema } from './service.schema';

export const appConfigSchema = z.object({
  redis: redisConfigSchema,
  mongodb: mongodbConfigSchema,
  postgres: postgresConfigSchema,
  questdb: questdbConfigSchema.optional(),
  proxy: proxyConfigSchema.optional(),
  browser: browserConfigSchema.optional(),
  queue: queueConfigSchema.optional(),
  service: z
    .object({
      name: z.string(),
      serviceName: z.string().optional(), // Standard kebab-case service name
      port: z.number().optional(),
    })
    .optional(),
});

export type AppConfig = z.infer<typeof appConfigSchema>;

// Re-export individual schemas and types
export * from './redis.schema';
export * from './mongodb.schema';
export * from './postgres.schema';
export * from './questdb.schema';
export * from './service.schema';
