"use strict";
require("dotenv").config({ path: __dirname + "/./../../.env" });

const APP_PORT = process.env.PORT || 5000;
const APP_BASE_URL = process.env.APP_BASE_URL || "http://localhost";

const APP_URL =
  process.env.NODE_ENV && process.env.NODE_ENV === "production"
    ? process.env.APP_URL || "http://market-alarm"
    : process.env.APP_URL || `${APP_BASE_URL}:${APP_PORT}`;

const STAGING = process.env.SETTINGS !== "production";

const DEFAULT_TIMEZONE = "Europe/Sarajevo";

const CRAWLER_INTERVAL = parseInt(process.env.CRAWLER_INTERVAL) || 60;
const STOP_CRAWLER = !!parseInt(process.env.STOP_CRAWLER);

const CHECK_UP_DAYS = parseInt(process.env.CHECK_UP_DAYS) || 10;

const AWS_EMAIL_CONFIG = {
  REGION: process.env.AWS_REGION || "",
  CREDENTIALS: {
    ACCESS_KEY_ID: process.env.AWS_KEY_ID || "",
    SECRET_ACCESS_KEY: process.env.AWS_SECRET_ACCESS_KEY || ""
  },
  SOURCE_EMAIL: process.env.SOURCE_EMAIL || ""
};

const MAX_REAL_ESTATES_IN_EMAIL =
  parseInt(process.env.MAX_REAL_ESTATES_IN_EMAIL) || 10;
const MAX_REAL_ESTATES_IN_FIRST_EMAIL =
  parseInt(process.env.MAX_REAL_ESTATES_IN_FIRST_EMAIL) || 5;

const PRINT_CRAWLER_DEBUG = process.env.PRINT_CRAWLER_DEBUG_INFO || 0;

const API_MAP_KEY = process.env.API_MAP_KEY || "";

const PROSTOR_LOGIN = {
  EMAIL: process.env.PROSTOR_LOGIN_EMAIL,
  PASSWORD: process.env.PROSTOR_LOGIN_PASS
};

module.exports = {
  APP_PORT,
  APP_URL,
  DEFAULT_TIMEZONE,
  CRAWLER_INTERVAL,
  STOP_CRAWLER,
  AWS_EMAIL_CONFIG,
  MAX_REAL_ESTATES_IN_EMAIL,
  MAX_REAL_ESTATES_IN_FIRST_EMAIL,
  PRINT_CRAWLER_DEBUG,
  API_MAP_KEY,
  STAGING,
  CHECK_UP_DAYS,
  PROSTOR_LOGIN

};
