import 'package:json_annotation/json_annotation.dart';

part 'group_batch_model.g.dart';

@JsonSerializable(explicitToJson: true)
class GroupBatch {
  final String? id;
  final String? recipientGroupId;
  final String? userId;
  final String? workspaceId;
  final String? currency;
  final String? description;
  final double? value;
  final String? status;
  final String? paymentProcessorLabel;
  final String? paymentProcessorName;
  final String? paymentProcessorImage;
  final String? transactionTemplate;
  final String? createdAt;
  final int? count;
  final int? successfulCount;
  final int? failedCount;

  const GroupBatch({
    this.id,
    this.recipientGroupId,
    this.userId,
    this.workspaceId,
    this.currency,
    this.description,
    this.value,
    this.status,
    this.paymentProcessorLabel,
    this.paymentProcessorName,
    this.paymentProcessorImage,
    this.transactionTemplate,
    this.createdAt,
    this.count,
    this.successfulCount,
    this.failedCount,
  });

  factory GroupBatch.fromJson(Map<String, dynamic> json) =>
      _$GroupBatchFromJson(json);

  Map<String, dynamic> toJson() => _$GroupBatchToJson(this);
}

@JsonSerializable(explicitToJson: true)
class GroupBatchItem {
  final String? id;
  final String? groupBatchId;
  final String? recipientName;
  final String? recipientPhone;
  final String? recipientAccount;
  final double? amount;
  final String? status;
  final String? transactionId;
  final String? errorMessage;
  final String? createdAt;
  final String? billName;
  final String? billProductName;
  final String? providerLabel;
  final String? providerImage;
  final String? creditAddress;

  const GroupBatchItem({
    this.id,
    this.groupBatchId,
    this.recipientName,
    this.recipientPhone,
    this.recipientAccount,
    this.amount,
    this.status,
    this.transactionId,
    this.errorMessage,
    this.createdAt,
    this.billName,
    this.billProductName,
    this.providerLabel,
    this.providerImage,
    this.creditAddress,
  });

  factory GroupBatchItem.fromJson(Map<String, dynamic> json) =>
      _$GroupBatchItemFromJson(json);

  Map<String, dynamic> toJson() => _$GroupBatchItemToJson(this);
}

@JsonSerializable(explicitToJson: true)
class CreateBatchRequest {
  final String recipientGroupId;
  final String userId;
  final String workspaceId;
  final String currency;
  final String description;
  final double amount;
  final String? paymentProcessorLabel;
  final String? paymentProcessorName;
  final String? paymentProcessorImage;

  const CreateBatchRequest({
    required this.recipientGroupId,
    required this.userId,
    required this.workspaceId,
    required this.currency,
    required this.description,
    required this.amount,
    this.paymentProcessorLabel,
    this.paymentProcessorName,
    this.paymentProcessorImage,
  });

  factory CreateBatchRequest.fromJson(Map<String, dynamic> json) =>
      _$CreateBatchRequestFromJson(json);

  Map<String, dynamic> toJson() => _$CreateBatchRequestToJson(this);
}

@JsonSerializable()
class BatchActionRequest {
  final String workspaceId;
  final String idempotencyKey;
  final String? authType;

  const BatchActionRequest({
    required this.workspaceId,
    required this.idempotencyKey,
    this.authType,
  });

  factory BatchActionRequest.fromJson(Map<String, dynamic> json) =>
      _$BatchActionRequestFromJson(json);

  Map<String, dynamic> toJson() => _$BatchActionRequestToJson(this);
}

@JsonSerializable(explicitToJson: true)
class GroupBatchUpdateRequest {
  String? id;
  String? workspaceId;
  String? paymentProcessorLabel;
  String? paymentProcessorName;
  String? paymentProcessorImage;

  GroupBatchUpdateRequest({
    this.id,
    this.workspaceId,
    this.paymentProcessorLabel,
    this.paymentProcessorName,
    this.paymentProcessorImage,
  });

  factory GroupBatchUpdateRequest.fromJson(Map<String, dynamic> json) =>
      _$GroupBatchUpdateRequestFromJson(json);

  Map<String, dynamic> toJson() => _$GroupBatchUpdateRequestToJson(this);
}
