mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-09 22:57:21 +00:00
96 lines
2.1 KiB
Dart
96 lines
2.1 KiB
Dart
enum AccessType {
|
|
onlineOnetime,
|
|
onlineMultiple,
|
|
offlineOnetime,
|
|
offlineMultiple,
|
|
}
|
|
|
|
extension AccessTypeExtension on AccessType {
|
|
String get value {
|
|
switch (this) {
|
|
case AccessType.onlineOnetime:
|
|
return "Online Password";
|
|
case AccessType.onlineMultiple:
|
|
return "online Multiple Password";
|
|
case AccessType.offlineOnetime:
|
|
return "Offline Onetime Password";
|
|
case AccessType.offlineMultiple:
|
|
return "Offline Multiple Password";
|
|
}
|
|
}
|
|
|
|
static AccessType fromString(String value) {
|
|
switch (value) {
|
|
case "ONLINE_ONETIME":
|
|
return AccessType.onlineOnetime;
|
|
case "ONLINE_MULTIPLE":
|
|
return AccessType.onlineMultiple;
|
|
case "OFFLINE_ONETIME":
|
|
return AccessType.offlineOnetime;
|
|
case "OFFLINE_MULTIPLE":
|
|
return AccessType.offlineMultiple;
|
|
default:
|
|
throw ArgumentError("Invalid access type: $value");
|
|
}
|
|
}
|
|
}
|
|
|
|
enum DeviseStatus {
|
|
online,
|
|
offline,
|
|
}
|
|
|
|
extension OnlineTypeExtension on DeviseStatus {
|
|
String get value {
|
|
switch (this) {
|
|
case DeviseStatus.online:
|
|
return "Online";
|
|
case DeviseStatus.offline:
|
|
return "Offline";
|
|
}
|
|
}
|
|
|
|
static DeviseStatus fromString(bool value) {
|
|
switch (value) {
|
|
case false:
|
|
return DeviseStatus.offline;
|
|
case true:
|
|
return DeviseStatus.online;
|
|
default:
|
|
throw ArgumentError("Invalid access type: $value");
|
|
}
|
|
}
|
|
}
|
|
|
|
enum AccessStatus {
|
|
expired,
|
|
effective,
|
|
toBeEffective,
|
|
}
|
|
|
|
extension AccessStatusExtension on AccessStatus {
|
|
String get value {
|
|
switch (this) {
|
|
case AccessStatus.expired:
|
|
return "Expired";
|
|
case AccessStatus.effective:
|
|
return "Effective";
|
|
case AccessStatus.toBeEffective:
|
|
return "To be effective";
|
|
}
|
|
}
|
|
|
|
static AccessStatus fromString(String value) {
|
|
switch (value) {
|
|
case "EXPIRED":
|
|
return AccessStatus.expired;
|
|
case "EFFECTIVE":
|
|
return AccessStatus.effective;
|
|
case "TO_BE_EFFECTIVE":
|
|
return AccessStatus.toBeEffective;
|
|
default:
|
|
throw ArgumentError("Invalid access type: $value");
|
|
}
|
|
}
|
|
}
|