// GENERATED CODE - DO NOT MODIFY BY HAND

// **************************************************************************
// RouterCenterGenerator
// **************************************************************************

import "package:gmalpha_flutter/PrestigeModel/PrestigeImpl.dart";
import "package:gmalpha_flutter/PrestigeModel/PrestigeRouter.dart";
import "package:gmalpha_flutter/AlbumModel/AlbumRouterImpl.dart";
import "package:gmalpha_flutter/AlbumModel/AlbumRouter.dart";
import "package:gmalpha_flutter/messageModel/MessageRouterImpl.dart";
import "package:gmalpha_flutter/messageModel/MessageRouter.dart";
import "package:gmalpha_flutter/userModel/UserRouterImpl.dart";
import "package:gmalpha_flutter/userModel/UserRouter.dart";

import "package:gmalpha_flutter/Annotations/RouterCenterRestore.dart";
import "package:gmalpha_flutter/Annotations/RouterBaser.dart";

class RouterCenterImpl {
  Map<String, RouterBaser> map;

  factory RouterCenterImpl() => _sharedInstance();

  static RouterCenterImpl _instance;

  RouterCenterImpl._() {
    if (map == null) {
      map = new Map();
      init();
    } else {
      throw Exception("too many RouterCenter instance!!!  fix it ");
    }
  }

  static RouterCenterImpl _sharedInstance() {
    if (_instance == null) {
      _instance = RouterCenterImpl._();
    }
    return _instance;
  }

  void init() {
    map.putIfAbsent("prestigeModel", () => PrestigeImpl());
    map.putIfAbsent("albumModel", () => AlbumRouterImpl());
    map.putIfAbsent("messageModel", () => MessageRouterImpl());
    map.putIfAbsent("userModel", () => UserRouterImpl());
  }

  RouterBaser getModel(String modelName) {
    return map[modelName];
  }

  PrestigeRouter findPrestigeRouter() {
    if (map["prestigeModel"] == null) {
      return null;
    }
    return map["prestigeModel"] as PrestigeRouter;
  }

  AlbumRouter findAlbumRouter() {
    if (map["albumModel"] == null) {
      return null;
    }
    return map["albumModel"] as AlbumRouter;
  }

  MessageRouter findMessageRouter() {
    if (map["messageModel"] == null) {
      return null;
    }
    return map["messageModel"] as MessageRouter;
  }

  UserRouter findUserRouter() {
    if (map["userModel"] == null) {
      return null;
    }
    return map["userModel"] as UserRouter;
  }
}
