export 'location_preferences.dart';

enum LocationPreferences { office, delivery, both }

 int enumToInt(LocationPreferences state) {
  return state.index;
}

LocationPreferences intToEnum(int value) {
  return LocationPreferences.values[value];
}

String locationPrefsToString(LocationPreferences p) {
  switch (p) {
    case LocationPreferences.office: return 'office';
    case LocationPreferences.delivery: return 'delivery';
    case LocationPreferences.both: return 'both';
  }
}

LocationPreferences locationPrefsFromValue(dynamic v) {
  if (v is int) return intToEnum(v);
  if (v is String) {
    switch (v) {
      case 'delivery': return LocationPreferences.delivery;
      case 'both': return LocationPreferences.both;
      default: return LocationPreferences.office;
    }
  }
  return LocationPreferences.office;
}
