2022-12-06 23:38:36 +00:00
|
|
|
import 'package:cake_wallet/generated/i18n.dart';
|
|
|
|
import 'package:cw_core/enumerable_item.dart';
|
|
|
|
|
|
|
|
class FiatApiMode extends EnumerableItem<int> with Serializable<int> {
|
|
|
|
const FiatApiMode({required String title, required int raw}) : super(title: title, raw: raw);
|
|
|
|
|
2024-01-18 01:37:10 +00:00
|
|
|
static const all = [FiatApiMode.enabled, FiatApiMode.disabled];
|
2022-12-06 23:38:36 +00:00
|
|
|
|
|
|
|
static const enabled = FiatApiMode(raw: 0, title: 'Enabled');
|
2024-01-18 01:37:10 +00:00
|
|
|
static const disabled = FiatApiMode(raw: 1, title: 'Disabled');
|
2022-12-06 23:38:36 +00:00
|
|
|
|
|
|
|
static FiatApiMode deserialize({required int raw}) {
|
|
|
|
switch (raw) {
|
|
|
|
case 0:
|
|
|
|
return enabled;
|
|
|
|
case 1:
|
|
|
|
return disabled;
|
|
|
|
default:
|
|
|
|
throw Exception('Unexpected token: $raw for FiatApiMode deserialize');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
String toString() {
|
|
|
|
switch (this) {
|
|
|
|
case FiatApiMode.enabled:
|
2022-12-07 12:04:14 +00:00
|
|
|
return S.current.enabled;
|
2022-12-06 23:38:36 +00:00
|
|
|
case FiatApiMode.disabled:
|
2022-12-07 12:04:14 +00:00
|
|
|
return S.current.disabled;
|
2022-12-06 23:38:36 +00:00
|
|
|
default:
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|