export const env = {
  NODE_ENV: process.env.NODE_ENV || 'development',
  PORT: Number(process.env.PORT || 3001),

  COOKIE_ACCESS_NAME: process.env.COOKIE_ACCESS_NAME || '__Host-access_token',
  COOKIE_REFRESH_NAME: process.env.COOKIE_REFRESH_NAME || '__Host-refresh_token',
  COOKIE_CSRF_NAME: process.env.COOKIE_CSRF_NAME || 'csrf_token',
  COOKIE_DOMAIN: process.env.COOKIE_DOMAIN || undefined,

  ACCESS_TOKEN_TTL_SEC: Number(process.env.ACCESS_TOKEN_TTL_SEC || 900),         // 15 min
  REFRESH_TOKEN_TTL_SEC: Number(process.env.REFRESH_TOKEN_TTL_SEC || 2592000),   // 30 days

  JWT_ISSUER: process.env.JWT_ISSUER || 'uno-click-bff',
  JWT_AUDIENCE: process.env.JWT_AUDIENCE || 'uno-click-web',
  JWT_PRIVATE_KEY: process.env.JWT_PRIVATE_KEY || '',
  JWT_PUBLIC_KEY: process.env.JWT_PUBLIC_KEY || '',

  COOKIE_SECURE: process.env.COOKIE_SECURE !== 'false',
  COOKIE_SAME_SITE: process.env.COOKIE_SAME_SITE || 'lax',

  N8N_BASE_URL: process.env.N8N_BASE_URL || 'https://n8n.uno-click.pip-test.ru',

  FRONTEND_URL: process.env.FRONTEND_URL || 'http://localhost:3000',

  // S3 (MinIO) Configuration
  S3_ENDPOINT: process.env.S3_ENDPOINT || 'http://127.0.0.1:9000',
  S3_ACCESS_KEY: process.env.S3_ACCESS_KEY || '',
  S3_SECRET_KEY: process.env.S3_SECRET_KEY || '',
  S3_BUCKET: process.env.S3_BUCKET || 'uno-click',
  S3_IMAGES_INPUT_FOLDER: process.env.S3_IMAGES_INPUT_FOLDER || 'images_input',
  S3_PRESIGNED_URL_EXPIRES_IN: Number(process.env.S3_PRESIGNED_URL_EXPIRES_IN || 3600),
  
  // Public S3 endpoint for browser access (via nginx proxy)
  S3_PUBLIC_ENDPOINT: process.env.S3_PUBLIC_ENDPOINT || 'https://uno-click.pip-test.ru/s3-upload/uno-click/',
};