/**config api */
import { ref } from 'vue'

const env = ref<string>(process.env.NODE_ENV || 'development')
export const apiUrlConfig = `${import.meta.env.VITE_API_URI_CONFIG}/v1`
export const apiUrlConfigV2 = `${import.meta.env.VITE_API_URI_CONFIG}/v2`

const config = ref<any>({
  development: {
    // API_URI: 'https://localhost:7007/api/v1',
    API_URI: apiUrlConfig,
    API_URI_V2: apiUrlConfigV2,
    MEET_URI: 'meet.frappet.com'
  },
  test: {
    API_URI: 'http://localhost:5010/api/v1',
    API_URI_V2: 'http://localhost:5010/api/v2',
    MEET_URI: 'meet.frappet.com'
  },
  production: {
    // API_URI: "https://localhost:5010",
    API_URI: apiUrlConfig,
    API_URI_V2: apiUrlConfigV2,
    MEET_URI: 'meet.frappet.com'
  }
})

const API_URI = ref<string>(config.value[env.value].API_URI)
const API_URI_V2 = ref<string>(config.value[env.value].API_URI_V2)
const MEET_URI = ref<string>(config.value[env.value].MEET_URI)

export default {
  env: env.value,
  config: config.value,
  API_URI: API_URI.value,
  API_URI_V2: API_URI_V2.value,
  MEET_URI: MEET_URI.value
}
