import { z } from 'zod';

const envSchema = z.object({
  PORT: z.coerce.number().default(4005),
  HOST: z.string().default('0.0.0.0'),
  NODE_ENV: z.enum(['development', 'production', 'test']).default('development'),
  CORS_ORIGIN: z.string().optional(),
  SERVICE_NAME: z.string().default('extraction-service'),
  COSMOS_ENDPOINT: z.string().min(1, 'COSMOS_ENDPOINT is required'),
  COSMOS_KEY: z.string().min(1, 'COSMOS_KEY is required'),
  COSMOS_DATABASE: z.string().default('lysnrai'),
  JWT_SECRET: z.string().min(1, 'JWT_SECRET is required'),
  DEFAULT_PRODUCT_ID: z.string().default('lysnrai'),
  PYTHON_SIDECAR_URL: z.string().default('http://localhost:4006'),
  DEFAULT_MODEL_ID: z.string().default('gemini-2.5-flash'),
});

export const config = envSchema.parse(process.env);
