77 lines
1.7 KiB
Dart
77 lines
1.7 KiB
Dart
import 'package:hive/hive.dart';
|
|
|
|
part 'user_data.g.dart';
|
|
|
|
@HiveType(typeId: 13)
|
|
class UserData extends HiveObject {
|
|
@HiveField(0)
|
|
final bool isFavorite;
|
|
|
|
@HiveField(1)
|
|
final bool isUserEdited;
|
|
|
|
@HiveField(2)
|
|
final String? memo;
|
|
|
|
// Pricing (Business Mode)
|
|
@HiveField(3)
|
|
final int? price; // Selling Price (User defined)
|
|
|
|
@HiveField(4)
|
|
final int? costPrice;
|
|
|
|
@HiveField(5)
|
|
final double markup;
|
|
|
|
@HiveField(6)
|
|
final Map<String, int>? priceVariants;
|
|
|
|
@HiveField(7)
|
|
final String? purchaseLocation;
|
|
|
|
@HiveField(8)
|
|
final String? drinkLocation; // For Consumer Mode
|
|
|
|
@HiveField(9)
|
|
final String? companion; // For Consumer Mode
|
|
|
|
UserData({
|
|
this.isFavorite = false,
|
|
this.isUserEdited = false,
|
|
this.memo,
|
|
this.price,
|
|
this.costPrice,
|
|
this.markup = 3.0,
|
|
this.priceVariants,
|
|
this.purchaseLocation,
|
|
this.drinkLocation,
|
|
this.companion,
|
|
});
|
|
|
|
UserData copyWith({
|
|
bool? isFavorite,
|
|
bool? isUserEdited,
|
|
String? memo,
|
|
int? price,
|
|
int? costPrice,
|
|
double? markup,
|
|
Map<String, int>? priceVariants,
|
|
String? purchaseLocation,
|
|
String? drinkLocation,
|
|
String? companion,
|
|
}) {
|
|
return UserData(
|
|
isFavorite: isFavorite ?? this.isFavorite,
|
|
isUserEdited: isUserEdited ?? this.isUserEdited,
|
|
memo: memo ?? this.memo,
|
|
price: price ?? this.price,
|
|
costPrice: costPrice ?? this.costPrice,
|
|
markup: markup ?? this.markup,
|
|
priceVariants: priceVariants ?? this.priceVariants,
|
|
purchaseLocation: purchaseLocation ?? this.purchaseLocation,
|
|
drinkLocation: drinkLocation ?? this.drinkLocation,
|
|
companion: companion ?? this.companion,
|
|
);
|
|
}
|
|
}
|