Files
superport_v2/lib/features/masters/warehouse/domain/entities/warehouse.dart

95 lines
2.1 KiB
Dart

class Warehouse {
Warehouse({
this.id,
required this.warehouseCode,
required this.warehouseName,
this.zipcode,
this.addressDetail,
this.isActive = true,
this.isDeleted = false,
this.note,
this.createdAt,
this.updatedAt,
});
final int? id;
final String warehouseCode;
final String warehouseName;
final WarehouseZipcode? zipcode;
final String? addressDetail;
final bool isActive;
final bool isDeleted;
final String? note;
final DateTime? createdAt;
final DateTime? updatedAt;
Warehouse copyWith({
int? id,
String? warehouseCode,
String? warehouseName,
WarehouseZipcode? zipcode,
String? addressDetail,
bool? isActive,
bool? isDeleted,
String? note,
DateTime? createdAt,
DateTime? updatedAt,
}) {
return Warehouse(
id: id ?? this.id,
warehouseCode: warehouseCode ?? this.warehouseCode,
warehouseName: warehouseName ?? this.warehouseName,
zipcode: zipcode ?? this.zipcode,
addressDetail: addressDetail ?? this.addressDetail,
isActive: isActive ?? this.isActive,
isDeleted: isDeleted ?? this.isDeleted,
note: note ?? this.note,
createdAt: createdAt ?? this.createdAt,
updatedAt: updatedAt ?? this.updatedAt,
);
}
}
class WarehouseZipcode {
WarehouseZipcode({
required this.zipcode,
this.sido,
this.sigungu,
this.roadName,
});
final String zipcode;
final String? sido;
final String? sigungu;
final String? roadName;
}
class WarehouseInput {
WarehouseInput({
required this.warehouseCode,
required this.warehouseName,
this.zipcode,
this.addressDetail,
this.isActive = true,
this.note,
});
final String warehouseCode;
final String warehouseName;
final String? zipcode;
final String? addressDetail;
final bool isActive;
final String? note;
Map<String, dynamic> toPayload() {
return {
'warehouse_code': warehouseCode,
'warehouse_name': warehouseName,
'zipcode': zipcode,
'address_detail': addressDetail,
'is_active': isActive,
'note': note,
};
}
}