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 {
|
2025-12-20 18:26:15 +00:00
|
|
|
MnemoCardsProductModel toModel() =>
|
|
|
|
|
MnemoCardsProductModelBase(productId: id, type: type.toModel());
|
2025-11-16 11:25:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
extension ProductModelTypeExt on MnemoCardsProductType {
|
|
|
|
|
MnemoCardsProductModelType toModel() => switch (this) {
|
2025-12-20 18:26:15 +00:00
|
|
|
MnemoCardsProductType.pack => MnemoCardsProductModelType.pack,
|
|
|
|
|
MnemoCardsProductType.subscription =>
|
|
|
|
|
MnemoCardsProductModelType.subscription,
|
|
|
|
|
MnemoCardsProductType.discount => MnemoCardsProductModelType.discount,
|
|
|
|
|
MnemoCardsProductType.unknown => MnemoCardsProductModelType.unknown,
|
|
|
|
|
MnemoCardsProductType.game => MnemoCardsProductModelType.game,
|
|
|
|
|
};
|
2025-11-16 11:25:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
extension ProductModelExt on MnemoCardsProductModel {
|
2025-12-20 18:26:15 +00:00
|
|
|
MnemoCardsProductDto toDto() =>
|
|
|
|
|
MnemoCardsProductDto(id: id?.toString(), type: type.toDto());
|
2025-11-16 11:25:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
extension ProductTypeExt on MnemoCardsProductModelType {
|
|
|
|
|
MnemoCardsProductType toDto() => switch (this) {
|
2025-12-20 18:26:15 +00:00
|
|
|
MnemoCardsProductModelType.pack => MnemoCardsProductType.pack,
|
|
|
|
|
MnemoCardsProductModelType.subscription =>
|
|
|
|
|
MnemoCardsProductType.subscription,
|
|
|
|
|
MnemoCardsProductModelType.discount => MnemoCardsProductType.discount,
|
|
|
|
|
MnemoCardsProductModelType.unknown => MnemoCardsProductType.unknown,
|
|
|
|
|
MnemoCardsProductModelType.game => MnemoCardsProductType.game,
|
|
|
|
|
};
|
2025-11-16 11:25:27 +00:00
|
|
|
}
|