Initial commit - app-padrao-1.0
This commit is contained in:
43
lib/features/services/data/models/service_model.dart
Normal file
43
lib/features/services/data/models/service_model.dart
Normal file
@@ -0,0 +1,43 @@
|
||||
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,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user