import { readSelectedApi } from 'helpers/selectedApi'

import { ENV, isProduction } from './env'

export const APIS = {
  preproduction: {
    api: 'https://api-test.instat.tv',
    auth: 'https://auth.instat.tv',
  },
  production: {
    api: 'https://api.instat.tv',
    auth: 'https://auth.instat.tv',
  },
  staging: {
    api: 'https://api-staging.instat.tv',
    auth: 'https://test-auth.instat.tv',
  },
}

const env = isProduction ? ENV : readSelectedApi() ?? ENV

export const AUTH_SERVICE = APIS[env].auth
export const API_ROOT = APIS[env].api
export const DATA_URL = `${API_ROOT}/data`
