2025-11-16 11:25:27 +00:00
|
|
|
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(
|
2025-12-13 20:55:50 +00:00
|
|
|
productId: id,
|
2025-11-16 11:25:27 +00:00
|
|
|
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,
|
|
|
|
|
};
|
|
|
|
|
}
|