import 'package:json_annotation/json_annotation.dart';

part 'account_model.g.dart';

@JsonSerializable()
class CurrencyModel {
  final String id;
  final String? createdAt;
  final String name;
  final String symbol;
  final String code;
  final double rate;
  final bool defaultCurrency;

  CurrencyModel({
    required this.id,
    this.createdAt,
    required this.name,
    required this.symbol,
    required this.code,
    required this.rate,
    required this.defaultCurrency,
  });

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

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

@JsonSerializable()
class AccountModel {
  final String name;
  final String description;
  final String accountNumber;
  final String alternateAccountNumber;
  final String type;
  final String category;
  final String ledger;
  final double balance;
  final String partyType;
  final String party;
  final CurrencyModel currency;
  final String customerStringId;
  final String companyStringId;

  AccountModel({
    required this.name,
    required this.description,
    required this.accountNumber,
    required this.alternateAccountNumber,
    required this.type,
    required this.category,
    required this.ledger,
    required this.balance,
    required this.partyType,
    required this.party,
    required this.currency,
    required this.customerStringId,
    required this.companyStringId,
  });

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

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