import { z } from "zod";
import { validateMintelEnv } from "@mintel/next-utils";

/**
 * Environment variable schema extension.
 */
const envExtension = {
  // Mail Configuration
  MAIL_HOST: z.string().optional(),
  MAIL_PORT: z.coerce.number().optional().default(587),
  MAIL_USER: z.string().optional(),
  MAIL_PASS: z.string().optional(),
  MAIL_FROM: z.string().optional().default("marc@mintel.me"),
  MAIL_RECIPIENTS: z.string().optional().default("marc@mintel.me"),

  // Analytics (Server-side)
  UMAMI_WEBSITE_ID: z.string().optional(),
  UMAMI_API_ENDPOINT: z
    .string()
    .url()
    .optional()
    .default("https://analytics.infra.mintel.me"),

  // Error Tracking
  SENTRY_DSN: z.string().url().optional(),
};

/**
 * Validated environment object.
 */
export const env = validateMintelEnv(envExtension);
