mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2024-09-09 21:37:18 +00:00
Reviewed-on: https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/pulls/268 Reviewed-by: Inex Code <inex.code@selfprivacy.org>
60 lines
1.3 KiB
Dart
60 lines
1.3 KiB
Dart
import 'package:hive/hive.dart';
|
|
import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/schema.graphql.dart';
|
|
|
|
part 'server_domain.g.dart';
|
|
|
|
@HiveType(typeId: 3)
|
|
class ServerDomain {
|
|
ServerDomain({
|
|
required this.domainName,
|
|
required this.provider,
|
|
});
|
|
|
|
@HiveField(0)
|
|
final String domainName;
|
|
|
|
// @HiveField(1)
|
|
|
|
@HiveField(2, defaultValue: DnsProviderType.cloudflare)
|
|
final DnsProviderType provider;
|
|
}
|
|
|
|
@HiveType(typeId: 100)
|
|
enum DnsProviderType {
|
|
@HiveField(0)
|
|
unknown,
|
|
@HiveField(1)
|
|
cloudflare,
|
|
@HiveField(2)
|
|
desec,
|
|
@HiveField(3)
|
|
digitalOcean;
|
|
|
|
factory DnsProviderType.fromGraphQL(final Enum$DnsProvider provider) {
|
|
switch (provider) {
|
|
case Enum$DnsProvider.CLOUDFLARE:
|
|
return cloudflare;
|
|
case Enum$DnsProvider.DESEC:
|
|
return desec;
|
|
case Enum$DnsProvider.DIGITALOCEAN:
|
|
return digitalOcean;
|
|
default:
|
|
return unknown;
|
|
}
|
|
}
|
|
|
|
String toInfectName() => switch (this) {
|
|
digitalOcean => 'DIGITALOCEAN',
|
|
cloudflare => 'CLOUDFLARE',
|
|
desec => 'DESEC',
|
|
unknown => 'UNKNOWN',
|
|
};
|
|
|
|
String get displayName => switch (this) {
|
|
digitalOcean => 'Digital Ocean DNS',
|
|
cloudflare => 'Cloudflare',
|
|
desec => 'deSEC',
|
|
unknown => 'Unknown',
|
|
};
|
|
}
|