import 'package:equatable/equatable.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:payment_plugin/utils/json.dart';

part '../../_generated/domain/models/stored_payment_method.g.dart';

@JsonSerializable()
class StoredPaymentMethod extends Equatable {
  final String brand;
  final String expiryMonth;
  final String expiryYear;
  final String holderName;
  final String id;
  final String lastFour;

  const StoredPaymentMethod({
    required this.brand,
    required this.expiryMonth,
    required this.expiryYear,
    required this.holderName,
    required this.id,
    required this.lastFour,
  });

  factory StoredPaymentMethod.fromJson(Json json) =>
      _$StoredPaymentMethodFromJson(json);

  Json toJson() => _$StoredPaymentMethodToJson(this);

  @override
  String toString() {
    return 'StoredPaymentMethod(brand: $brand, expiryMonth: $expiryMonth, expiryYear: $expiryYear, holderName: $holderName, id: $id, lastFour: $lastFour)';
  }

  @override
  List<Object?> get props => [id, brand, expiryMonth, expiryYear, holderName, lastFour];
}