import { z } from 'zod';

export const EnvVarSchema = z.object({
  id: z.string().min(1),
  name: z.string().min(1),
  value: z.string().default(''),
  isSecret: z.boolean().default(true),
  source: z.enum(['local', 'azure-key-vault']).default('local'),
  azureKeyVaultName: z.string().optional(),
  azureSecretName: z.string().optional(),
  updatedAt: z.string().datetime().default(() => new Date().toISOString()),
});

export const EnvVarParamsSchema = z.object({
  id: z.string().min(1),
});

export const EnvVarInputSchema = EnvVarSchema.omit({ name: true }).partial().extend({
  name: z.string().min(1),
});

export type EnvVar = z.infer<typeof EnvVarSchema>;
