80 lines
1.9 KiB
Dart
80 lines
1.9 KiB
Dart
import 'package:json_annotation/json_annotation.dart';
|
|
import 'package:niogu_ecommerce_v1/core/utils/converter.dart';
|
|
import 'package:niogu_ecommerce_v1/features/account/domain/entities/account.dart';
|
|
|
|
part 'account_model.g.dart';
|
|
|
|
@JsonSerializable()
|
|
class CustomerInfoResponse {
|
|
final String name;
|
|
final String? email;
|
|
@JsonKey(name: 'phone_number')
|
|
final String phoneNumber;
|
|
|
|
const CustomerInfoResponse({
|
|
required this.name,
|
|
this.email,
|
|
required this.phoneNumber,
|
|
});
|
|
|
|
factory CustomerInfoResponse.fromJson(Map<String, dynamic> json) =>
|
|
_$CustomerInfoResponseFromJson(json);
|
|
|
|
Map<String, dynamic> toJson() => _$CustomerInfoResponseToJson(this);
|
|
|
|
CustomerInfo toCustomerInfo() {
|
|
return CustomerInfo(name: name, email: email, phoneNumber: phoneNumber);
|
|
}
|
|
}
|
|
|
|
@JsonSerializable()
|
|
class CustomerInfoRequest {
|
|
final String name;
|
|
|
|
const CustomerInfoRequest({required this.name});
|
|
|
|
factory CustomerInfoRequest.fromJson(Map<String, dynamic> json) =>
|
|
_$CustomerInfoRequestFromJson(json);
|
|
|
|
Map<String, dynamic> toJson() => _$CustomerInfoRequestToJson(this);
|
|
}
|
|
|
|
@JsonSerializable()
|
|
class CustomerAddressModel {
|
|
final String uuid;
|
|
|
|
final String label;
|
|
|
|
@JsonKey(name: 'full_address')
|
|
final String fullAddress;
|
|
|
|
@JsonKey(fromJson: toDouble)
|
|
final double latitude;
|
|
|
|
@JsonKey(fromJson: toDouble)
|
|
final double longitude;
|
|
|
|
const CustomerAddressModel({
|
|
required this.uuid,
|
|
required this.label,
|
|
required this.fullAddress,
|
|
required this.latitude,
|
|
required this.longitude,
|
|
});
|
|
|
|
factory CustomerAddressModel.fromJson(Map<String, dynamic> json) =>
|
|
_$CustomerAddressModelFromJson(json);
|
|
|
|
Map<String, dynamic> toJson() => _$CustomerAddressModelToJson(this);
|
|
|
|
CustomerAddress toCustomerAddress() {
|
|
return CustomerAddress(
|
|
uuid: uuid,
|
|
label: label,
|
|
fullAddress: fullAddress,
|
|
latitude: latitude,
|
|
longitude: longitude,
|
|
);
|
|
}
|
|
}
|