import 'package:mnemo_cards_common_backend/mnemo_cards_common_backend.dart'; import 'package:mnemo_cards_common/mnemo_cards_common.dart'; extension ProductExt on MnemoCardsProductDto { MnemoCardsProductModel toModel() => MnemoCardsProductModelBase( productId: id, type: type.toModel(), ); } extension ProductModelTypeExt on MnemoCardsProductType { MnemoCardsProductModelType toModel() => switch (this) { MnemoCardsProductType.pack => MnemoCardsProductModelType.pack, MnemoCardsProductType.subscription => MnemoCardsProductModelType.subscription, MnemoCardsProductType.discount => MnemoCardsProductModelType.discount, MnemoCardsProductType.unknown => MnemoCardsProductModelType.unknown, MnemoCardsProductType.game => MnemoCardsProductModelType.game, }; } extension ProductModelExt on MnemoCardsProductModel { MnemoCardsProductDto toDto() => MnemoCardsProductDto( id: id?.toString(), type: type.toDto(), ); } extension ProductTypeExt on MnemoCardsProductModelType { MnemoCardsProductType toDto() => switch (this) { MnemoCardsProductModelType.pack => MnemoCardsProductType.pack, MnemoCardsProductModelType.subscription => MnemoCardsProductType.subscription, MnemoCardsProductModelType.discount => MnemoCardsProductType.discount, MnemoCardsProductModelType.unknown => MnemoCardsProductType.unknown, MnemoCardsProductModelType.game => MnemoCardsProductType.game, }; }