import 'package:easy_localization/easy_localization.dart';
import 'package:mohem_flutter_app/models/itg_forms_models/request_detail_model.dart';
import 'package:mohem_flutter_app/models/member_information_list_model.dart';
import 'package:mohem_flutter_app/models/member_login_list_model.dart';
import 'package:mohem_flutter_app/models/post_params_model.dart';
import 'package:mohem_flutter_app/models/privilege_list_model.dart';
import 'package:mohem_flutter_app/models/worklist_response_model.dart';

class AppState {
  static final AppState _instance = AppState._internal();

  AppState._internal();

  factory AppState() => _instance;

  bool isAuthenticated = false;

  set setIsAuthenticated(v) => isAuthenticated = v;

  bool isLogged = false;

  set setLogged(v) => isLogged = v;

  bool? get getIsLogged => isLogged;

  String? forgetPasswordTokenID;

  set setForgetPasswordTokenID(token) => forgetPasswordTokenID = token;

  String? get getForgetPasswordTokenID => forgetPasswordTokenID;

  //Wifi info
  String? mohemmWifiSSID;

  set setMohemmWifiSSID(v) => mohemmWifiSSID = mohemmWifiSSID;

  String? get getMohemmWifiSSID => mohemmWifiSSID;

  String? mohemmWifiPassword;

  set setMohemmWifiPassword(v) => mohemmWifiPassword = v;

  String? get getMohemmWifiPassword => mohemmWifiPassword;

  PostParamsModel? _postParams;

  PostParamsModel? get postParamsObject => _postParams;

  Map<String, dynamic> get postParamsJson => isLogged ? (_postParams?.toJsonAfterLogin() ?? {}) : (_postParams?.toJson() ?? {});

  void setPostParamsModel(PostParamsModel _postParams) {
    this._postParams = _postParams;
  }

  bool isArabic(context) => EasyLocalization.of(context)?.locale.languageCode == "ar";

  String? _username;

  // todo ''sikander' added password for now, later will remove & improve
  String? password;

  set setUserName(v) => _username = v;

  String? get getUserName => _username;

  set setUserPassword(_password) => password = _password;

  MemberLoginListModel? _memberLoginList;

  MemberLoginListModel? get memberLoginList => _memberLoginList;

  set setMemberLoginListModel(MemberLoginListModel? _memberLoginList) => this._memberLoginList = _memberLoginList;

  MemberInformationListModel? _memberInformationList;

  MemberInformationListModel? get memberInformationList => _memberInformationList;

  set setMemberInformationListModel(MemberInformationListModel? _memberInformationList) => this._memberInformationList = _memberInformationList;

  List<PrivilegeListModel>? _privilegeListModel;

  List<PrivilegeListModel>? get privilegeListModel => _privilegeListModel;

  set setPrivilegeListModel(List<PrivilegeListModel>? _privilegeListModel) => this._privilegeListModel = _privilegeListModel;

  List<WorkListResponseModel>? workList;

  set setWorkList(List<WorkListResponseModel>? _workList) => workList = _workList;

  int? workListIndex;

  set setWorkListIndex(int? _workListIndex) => workListIndex = _workListIndex;

  List<RequestDetails>? requestAllList;

  set setRequestAllList(List<RequestDetails>? _requestAllList) => requestAllList = _requestAllList;

  int? itgWorkListIndex;

  set setItgWorkListIndex(int? _itgWorkListIndex) => itgWorkListIndex = _itgWorkListIndex;
}
