import 'package:fotodocumentation/controller/customer_controller.dart';
import 'package:fotodocumentation/controller/login_controller.dart';
import 'package:fotodocumentation/controller/picture_controller.dart';
import 'package:fotodocumentation/pages/ui_utils/general_style.dart';
import 'package:fotodocumentation/utils/http_client_utils.dart';
import 'package:fotodocumentation/utils/jwt_token_storage.dart';
import 'package:fotodocumentation/utils/login_credentials.dart';
import 'package:fotodocumentation/utils/url_utils.dart';

class DiContainer {
  static final DiContainer instance = DiContainer._privateConstructor();
  DiContainer._privateConstructor();

  final _container = {};

  static T get<T>() {
    return instance._container[T] as T;
  }

  void initState() {
    DiContainer.instance.put(LoginCredentials, LoginCredentialsImpl());
    DiContainer.instance.put(GeneralStyle, GeneralStyleImpl());
    DiContainer.instance.put(JwtTokenStorage, JwtTokenStorageImpl());
    DiContainer.instance.put(HttpClientUtils, HttpCLientUtilsImpl());
    DiContainer.instance.put(UrlUtils, UrlUtilsImpl());
    DiContainer.instance.put(LoginController, LoginControllerImpl());
    DiContainer.instance.put(CustomerController, CustomerControllerImpl());
    DiContainer.instance.put(PictureController, PictureControllerImpl());
  }

  void put<T>(Type key, T object) {
    _container[key] = object;
  }

  T get2<T>() {
    return _container[T] as T;
  }
}
