49 lines
1.3 KiB
Dart
49 lines
1.3 KiB
Dart
import 'package:json_annotation/json_annotation.dart';
|
|
import 'package:qpay/screens/groups/models/group_batch_model.dart';
|
|
|
|
part 'create_group_from_file_response.g.dart';
|
|
|
|
@JsonSerializable(explicitToJson: true)
|
|
class FileUploadError {
|
|
final int lineNumber;
|
|
final String account;
|
|
final String name;
|
|
final String message;
|
|
|
|
const FileUploadError({
|
|
required this.lineNumber,
|
|
required this.account,
|
|
required this.name,
|
|
required this.message,
|
|
});
|
|
|
|
factory FileUploadError.fromJson(Map<String, dynamic> json) =>
|
|
_$FileUploadErrorFromJson(json);
|
|
|
|
Map<String, dynamic> toJson() => _$FileUploadErrorToJson(this);
|
|
}
|
|
|
|
@JsonSerializable(explicitToJson: true)
|
|
class CreateGroupFromFileResponse {
|
|
final GroupBatch? batch;
|
|
final int totalRows;
|
|
final int successCount;
|
|
final int errorCount;
|
|
final List<FileUploadError> errors;
|
|
|
|
const CreateGroupFromFileResponse({
|
|
this.batch,
|
|
required this.totalRows,
|
|
required this.successCount,
|
|
required this.errorCount,
|
|
required this.errors,
|
|
});
|
|
|
|
factory CreateGroupFromFileResponse.fromJson(Map<String, dynamic> json) =>
|
|
_$CreateGroupFromFileResponseFromJson(json);
|
|
|
|
Map<String, dynamic> toJson() => _$CreateGroupFromFileResponseToJson(this);
|
|
|
|
bool get isSuccess => errors.isEmpty;
|
|
}
|