39 lines
1.2 KiB
Dart
39 lines
1.2 KiB
Dart
|
|
part of '../outlet_dtos.dart';
|
||
|
|
|
||
|
|
@freezed
|
||
|
|
class OutletDto with _$OutletDto {
|
||
|
|
const OutletDto._();
|
||
|
|
|
||
|
|
const factory OutletDto({
|
||
|
|
@JsonKey(name: "id") String? id,
|
||
|
|
@JsonKey(name: "organization_id") String? organizationId,
|
||
|
|
@JsonKey(name: "name") String? name,
|
||
|
|
@JsonKey(name: "address") String? address,
|
||
|
|
@JsonKey(name: "phone_number") String? phoneNumber,
|
||
|
|
@JsonKey(name: "business_type") String? businessType,
|
||
|
|
@JsonKey(name: "currency") String? currency,
|
||
|
|
@JsonKey(name: "tax_rate") double? taxRate,
|
||
|
|
@JsonKey(name: "is_active") bool? isActive,
|
||
|
|
@JsonKey(name: "created_at") String? createdAt,
|
||
|
|
@JsonKey(name: "updated_at") String? updatedAt,
|
||
|
|
}) = _OutletDto;
|
||
|
|
|
||
|
|
factory OutletDto.fromJson(Map<String, dynamic> json) =>
|
||
|
|
_$OutletDtoFromJson(json);
|
||
|
|
|
||
|
|
/// Mapping ke domain
|
||
|
|
Outlet toDomain() => Outlet(
|
||
|
|
id: id ?? '',
|
||
|
|
organizationId: organizationId ?? '',
|
||
|
|
name: name ?? '',
|
||
|
|
address: address ?? '',
|
||
|
|
phoneNumber: phoneNumber ?? '',
|
||
|
|
businessType: businessType ?? '',
|
||
|
|
currency: currency ?? '',
|
||
|
|
taxRate: taxRate ?? 0.0,
|
||
|
|
isActive: isActive ?? false,
|
||
|
|
createdAt: createdAt ?? '',
|
||
|
|
updatedAt: updatedAt ?? '',
|
||
|
|
);
|
||
|
|
}
|