44 lines
969 B
Dart
44 lines
969 B
Dart
import 'package:hive/hive.dart';
|
|
|
|
part 'service_model.g.dart';
|
|
|
|
@HiveType(typeId: 6) // TypeId 0=User, 1=Haircut, 2=Product, 3=TransactionType/4=Transaction, 5=Settings
|
|
class ServiceModel {
|
|
@HiveField(0)
|
|
final String id;
|
|
|
|
@HiveField(1)
|
|
final String name; // Ex: Corte Máquina, Barba
|
|
|
|
@HiveField(2)
|
|
final double price; // Preço padrão
|
|
|
|
@HiveField(3)
|
|
final int durationMinutes; // Duração estimada (opcional, bom ter)
|
|
|
|
@HiveField(4)
|
|
final String userId; // Para segregar por usuário
|
|
|
|
ServiceModel({
|
|
required this.id,
|
|
required this.name,
|
|
required this.price,
|
|
this.durationMinutes = 30,
|
|
required this.userId,
|
|
});
|
|
|
|
ServiceModel copyWith({
|
|
String? name,
|
|
double? price,
|
|
int? durationMinutes,
|
|
}) {
|
|
return ServiceModel(
|
|
id: id,
|
|
name: name ?? this.name,
|
|
price: price ?? this.price,
|
|
durationMinutes: durationMinutes ?? this.durationMinutes,
|
|
userId: userId,
|
|
);
|
|
}
|
|
}
|