28 lines
834 B
Dart
28 lines
834 B
Dart
part of '../wallet_dtos.dart';
|
|||
|
|
|
||
|
|
@freezed
|
||
|
|
abstract class OutletDto with _$OutletDto {
|
||
|
|
const factory OutletDto({
|
||
|
|
@JsonKey(name: 'id') String? id,
|
||
|
|
@JsonKey(name: 'name') String? name,
|
||
|
|
@JsonKey(name: 'address') String? address,
|
||
|
|
@JsonKey(name: 'accepts_point_payment') bool? acceptsPointPayment,
|
||
|
|
@JsonKey(name: 'earns_points') bool? earnsPoints,
|
||
|
|
@JsonKey(name: 'earns_coins') bool? earnsCoins,
|
||
|
|
}) = _OutletDto;
|
||
|
|
|
||
|
|
factory OutletDto.fromJson(Map<String, dynamic> json) =>
|
||
|
|
_$OutletDtoFromJson(json);
|
||
|
|
|
||
|
|
const OutletDto._();
|
||
|
|
|
||
|
|
Outlet toDomain() => Outlet(
|
||
|
|
id: id ?? '',
|
||
|
|
name: name ?? '',
|
||
|
|
address: (address?.trim().isEmpty ?? true) ? null : address!.trim(),
|
||
|
|
acceptsPointPayment: acceptsPointPayment ?? false,
|
||
|
|
earnsPoints: earnsPoints ?? false,
|
||
|
|
earnsCoins: earnsCoins ?? false,
|
||
|
|
);
|
||
|
|
}
|