2021-08-07 22:34:44 +02:00
|
|
|
import 'package:equatable/equatable.dart';
|
|
|
|
import 'package:nc_photos/account.dart';
|
2023-02-23 15:49:17 +01:00
|
|
|
import 'package:np_common/ci_string.dart';
|
2022-12-08 16:39:13 +01:00
|
|
|
import 'package:to_string/to_string.dart';
|
|
|
|
|
|
|
|
part 'sharee.g.dart';
|
2021-08-07 22:34:44 +02:00
|
|
|
|
|
|
|
enum ShareeType {
|
|
|
|
user,
|
|
|
|
group,
|
|
|
|
remote,
|
|
|
|
remoteGroup,
|
|
|
|
email,
|
|
|
|
circle,
|
|
|
|
room,
|
|
|
|
deck,
|
|
|
|
lookup,
|
|
|
|
}
|
|
|
|
|
2022-12-08 16:39:13 +01:00
|
|
|
@ToString(ignoreNull: true)
|
2021-08-07 22:34:44 +02:00
|
|
|
class Sharee with EquatableMixin {
|
|
|
|
Sharee({
|
|
|
|
required this.type,
|
|
|
|
required this.label,
|
|
|
|
required this.shareType,
|
|
|
|
required this.shareWith,
|
|
|
|
this.shareWithDisplayNameUnique,
|
|
|
|
});
|
|
|
|
|
|
|
|
@override
|
2022-12-08 16:39:13 +01:00
|
|
|
String toString() => _$toString();
|
2021-08-07 22:34:44 +02:00
|
|
|
|
|
|
|
@override
|
|
|
|
get props => [
|
|
|
|
type,
|
|
|
|
label,
|
|
|
|
shareType,
|
|
|
|
shareWith,
|
|
|
|
shareWithDisplayNameUnique,
|
|
|
|
];
|
|
|
|
|
|
|
|
final ShareeType type;
|
|
|
|
final String label;
|
|
|
|
final int shareType;
|
2021-11-12 22:13:02 +01:00
|
|
|
final CiString shareWith;
|
2021-08-07 22:34:44 +02:00
|
|
|
final String? shareWithDisplayNameUnique;
|
|
|
|
}
|
|
|
|
|
|
|
|
class ShareeRepo {
|
|
|
|
ShareeRepo(this.dataSrc);
|
|
|
|
|
|
|
|
/// See [ShareeDataSource.list]
|
2021-09-15 08:58:06 +02:00
|
|
|
Future<List<Sharee>> list(Account account) => dataSrc.list(account);
|
2021-08-07 22:34:44 +02:00
|
|
|
|
|
|
|
final ShareeDataSource dataSrc;
|
|
|
|
}
|
|
|
|
|
|
|
|
abstract class ShareeDataSource {
|
|
|
|
/// List all sharees of this account
|
|
|
|
Future<List<Sharee>> list(Account account);
|
|
|
|
}
|