70 lines
1.5 KiB
Dart
70 lines
1.5 KiB
Dart
import 'package:hive/hive.dart';
|
|
|
|
part 'haircut_model.g.dart';
|
|
|
|
@HiveType(typeId: 1)
|
|
class HaircutModel extends HiveObject {
|
|
@HiveField(0)
|
|
final String id;
|
|
|
|
@HiveField(1)
|
|
final String userId;
|
|
|
|
@HiveField(2)
|
|
final String clientName;
|
|
|
|
@HiveField(3)
|
|
final String serviceType;
|
|
|
|
@HiveField(4)
|
|
final double price;
|
|
|
|
@HiveField(5)
|
|
final DateTime dateTime;
|
|
|
|
@HiveField(6)
|
|
final String? notes;
|
|
|
|
@HiveField(7)
|
|
final String? transactionId; // Link com a transação financeira
|
|
|
|
@HiveField(8, defaultValue: 'Dinheiro')
|
|
final String paymentMethod;
|
|
|
|
HaircutModel({
|
|
required this.id,
|
|
required this.userId,
|
|
required this.clientName,
|
|
required this.serviceType,
|
|
required this.price,
|
|
required this.dateTime,
|
|
this.notes,
|
|
this.transactionId,
|
|
this.paymentMethod = 'Dinheiro',
|
|
});
|
|
|
|
HaircutModel copyWith({
|
|
String? id,
|
|
String? userId,
|
|
String? clientName,
|
|
String? serviceType,
|
|
double? price,
|
|
DateTime? dateTime,
|
|
String? notes,
|
|
String? transactionId,
|
|
String? paymentMethod,
|
|
}) {
|
|
return HaircutModel(
|
|
id: id ?? this.id,
|
|
userId: userId ?? this.userId,
|
|
clientName: clientName ?? this.clientName,
|
|
serviceType: serviceType ?? this.serviceType,
|
|
price: price ?? this.price,
|
|
dateTime: dateTime ?? this.dateTime,
|
|
notes: notes ?? this.notes,
|
|
transactionId: transactionId ?? this.transactionId,
|
|
paymentMethod: paymentMethod ?? this.paymentMethod,
|
|
);
|
|
}
|
|
}
|