ChatAccountDepartmentModel.fromJson constructor

ChatAccountDepartmentModel.fromJson(
  1. Map json
)

Implementation

factory ChatAccountDepartmentModel.fromJson(Map json) {
  String name = json['name'];
  String id = json['id'];
  DEPARTMENT_STATUS status = DEPARTMENT_STATUS.OFFLINE;
  switch (json['status']) {
    case 'AWAY':
      status = DEPARTMENT_STATUS.AWAY;
      break;
    case 'ONLINE':
      status = DEPARTMENT_STATUS.ONLINE;
      break;
    case 'OFFLINE':
      status = DEPARTMENT_STATUS.OFFLINE;
      break;
    default:
      status = DEPARTMENT_STATUS.OFFLINE;
  }

  return ChatAccountDepartmentModel(name, id, status);
}