import { initializeApp, Scope, type NavigraphApp } from 'navigraph/app';
import { getAuth } from 'navigraph/auth';
import { getChartsAPI } from 'navigraph/charts';

const config: NavigraphApp = {
  clientId: import.meta.env.VITE_NG_CLIENT_ID,
  clientSecret: import.meta.env.VITE_NG_CLIENT_SECRET,
  scopes: [Scope.CHARTS],
};

initializeApp(config);

export const auth = getAuth({
  storage: {
    // Optional
    getItem: (key) => localStorage.getItem('NG' + key),
    setItem: (key, value) => localStorage.setItem('NG' + key, value),
  },
});

export const charts = getChartsAPI();
