import 'package:fcs/domain/entities/setting.dart';
import 'package:fcs/domain/entities/user.dart';
import 'package:flutter/foundation.dart';
import 'package:fcs/helpers/api_helper.dart';

import 'main_model.dart';

abstract class BaseModel extends ChangeNotifier {
  User user;
  Setting setting;
  MainModel mainModel;

  void initUser(User user) async {
    this.user = user;
  }

  void privilegeChanged() {}

  void initSetting(Setting setting) async {
    this.setting = setting;
  }

  void notify() {
    notifyListeners();
  }

  void logout() {}

// request makes http request
// if token is null
  dynamic request(
    String path,
    method, {
    dynamic payload,
    String token,
    String url,
  }) async {
    return await requestAPI(path, method,
        payload: payload, token: token, url: url);
  }
}
