export default () => ({
  port: parseInt(process.env.API_PORT || '3000', 10),
  database: {
    url: process.env.DATABASE_URL || 'postgres://corrosion:corrosion_dev@localhost:5432/corrosion',
    maxConnections: parseInt(process.env.DATABASE_MAX_CONNECTIONS || '20', 10),
  },
  nats: {
    url: process.env.NATS_URL || 'nats://localhost:4222',
  },
  jwt: {
    secret: process.env.JWT_SECRET || 'change-me',
    accessExpirySeconds: parseInt(process.env.JWT_ACCESS_EXPIRY_SECONDS || '14400', 10),
    refreshExpirySeconds: parseInt(process.env.JWT_REFRESH_EXPIRY_SECONDS || '604800', 10),
  },
  encryption: {
    key: process.env.ENCRYPTION_KEY || '',
  },
  admin: {
    email: process.env.ADMIN_EMAIL || '',
    password: process.env.ADMIN_PASSWORD || '',
    username: process.env.ADMIN_USERNAME || 'Commander',
    licenseKey: process.env.ADMIN_LICENSE_KEY || '',
  },
  cloudflare: {
    apiToken: process.env.CLOUDFLARE_API_TOKEN || '',
    zoneId: process.env.CLOUDFLARE_ZONE_ID || '',
    baseDomain: process.env.BASE_DOMAIN || 'corrosionmgmt.com',
  },
  steam: {
    apiKey: process.env.STEAM_API_KEY || '',
  },
  smtp: {
    host: process.env.SMTP_HOST || '',
    port: parseInt(process.env.SMTP_PORT || '587', 10),
    username: process.env.SMTP_USERNAME || '',
    password: process.env.SMTP_PASSWORD || '',
    from: process.env.SMTP_FROM || 'noreply@corrosionmgmt.com',
  },
  frontend: {
    url: process.env.FRONTEND_URL || 'http://localhost:5174',
  },
});
