import dotenv from "dotenv";
dotenv.config();

export const env = {
  nodeEnv: process.env.NODE_ENV || "development",
  port: Number(process.env.PORT || 8080),
  corsOrigin: process.env.CORS_ORIGIN || "http://localhost:5173",
  jwtAccessSecret: process.env.JWT_ACCESS_SECRET || "change-me-access",
  jwtRefreshSecret: process.env.JWT_REFRESH_SECRET || "change-me-refresh",
  cookieSecure: String(process.env.COOKIE_SECURE || "false") === "true",
  forceMfaForPrivileged: String(process.env.FORCE_MFA_FOR_PRIVILEGED || "true") === "true",
  rpId: process.env.RP_ID || "localhost",
  rpOrigin: process.env.RP_ORIGIN || "http://localhost:5173",
  databaseUrl: process.env.DATABASE_URL || "postgres://br_app:change_me@localhost:5432/br_office",
  uploadDir: process.env.UPLOAD_DIR || "./uploads",
  storageProvider: process.env.STORAGE_PROVIDER || "local",
  s3Endpoint: process.env.S3_ENDPOINT || "",
  s3Bucket: process.env.S3_BUCKET || "br-office",
  s3AccessKey: process.env.S3_ACCESS_KEY || "",
  s3SecretKey: process.env.S3_SECRET_KEY || "",
  clamavHost: process.env.CLAMAV_HOST || "localhost",
  clamavPort: Number(process.env.CLAMAV_PORT || 3310),
  fileEncryptionEnabled: String(process.env.FILE_ENCRYPTION_ENABLED || "true") === "true",
  fileEncryptionKey: process.env.FILE_ENCRYPTION_KEY || "",
  smtpHost: process.env.SMTP_HOST || "",
  smtpPort: Number(process.env.SMTP_PORT || 587),
  smtpUser: process.env.SMTP_USER || "",
  smtpPass: process.env.SMTP_PASS || "",
  smtpFrom: process.env.SMTP_FROM || "br-office@localhost",
  smtpSecure: String(process.env.SMTP_SECURE || "false") === "true",
  smtpRequireTls: String(process.env.SMTP_REQUIRE_TLS || "false") === "true",
};
