import 'package:json_annotation/json_annotation.dart';

part 'statement_model.g.dart';

@JsonSerializable()
class TransactionModel {
  final String name;
  final String narration;
  final String party;
  final String company;
  final String postingDate;
  final double amount;
  final String account;
  final String accountName;
  final String currency;
  final String type;
  final double balance;

  TransactionModel({
    required this.name,
    required this.narration,
    required this.party,
    required this.company,
    required this.postingDate,
    required this.amount,
    required this.account,
    required this.accountName,
    required this.currency,
    required this.type,
    required this.balance,
  });

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

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

@JsonSerializable()
class StatementModel {
  final int startBalance;
  final double endBalance;
  final List<TransactionModel> transactions;
  final String accountName;
  final String accountNumber;
  final String startDate;
  final String endDate;

  StatementModel({
    required this.startBalance,
    required this.endBalance,
    required this.transactions,
    required this.accountName,
    required this.accountNumber,
    required this.startDate,
    required this.endDate,
  });

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

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