import 'reflect-metadata';
import { Container, interfaces } from 'inversify';
import { MainAppWindow } from '../modules/app-window/main-app-window';
import { I18nTranslator } from '../modules/i18n/i18n-translator';
import { Logger } from '../modules/logger/logger';
import { NhentaiApi } from '../modules/nhentai/nhentai-api';
import '../modules/nhentai/nhentai-ipc-controller';
import { NhentaiAppWindow } from '../modules/nhentai/nhentai-app-window';
import { SessionHelper } from '../modules/session/session-helper';
import { Store } from '../modules/store/store';
import BindingToSyntax = interfaces.BindingToSyntax;

export const container = {
  original: new Container({ defaultScope: 'Singleton', skipBaseClassChecks: true }),
  bind<T>(key: string): BindingToSyntax<T> {
    return this.original.bind<T>(Symbol.for(key));
  },
  unbind(key: string): void {
    return this.original.unbind(Symbol.for(key));
  },
  get<T>(key: string): T {
    return this.original.get<T>(Symbol.for(key));
  },
};

container.bind('logger').to(Logger);

container.bind('i18n-translator').to(I18nTranslator);

container.bind('store').to(Store);

container.bind('session-helper').to(SessionHelper);

container.bind('nhentai-api').to(NhentaiApi);
container.bind('nhentai-app-window').to(NhentaiAppWindow);

container.bind('app-window-main').to(MainAppWindow);
