Files
carwash_vendor_app-frontend/lib/models/shop_model.dart

76 lines
1.3 KiB
Dart

import 'package:hive/hive.dart';
part 'shop_model.g.dart';
@HiveType(typeId: 0)
class ShopModel {
@HiveField(0)
bool success;
@HiveField(1)
ShopDetails user;
@HiveField(2)
String token;
@HiveField(3)
String message;
ShopModel({
required this.success,
required this.user,
required this.token,
required this.message,
});
factory ShopModel.fromJson(Map<String, dynamic> json) => ShopModel(
success: json['success'],
user: ShopDetails.fromJson(json['user']),
token: json['token'],
message: json['message'],
);
Map<String, dynamic> toJson() => {
'success': success,
'user': user.toJson(),
'token': token,
'message': message,
};
}
@HiveType(typeId: 1)
class ShopDetails {
@HiveField(0)
String id;
@HiveField(1)
String name;
@HiveField(2)
String email;
@HiveField(3)
String role;
ShopDetails({
required this.id,
required this.name,
required this.email,
required this.role,
});
factory ShopDetails.fromJson(Map<String, dynamic> json) => ShopDetails(
id: json['id'],
name: json['name'],
email: json['email'],
role: json['role'],
);
Map<String, dynamic> toJson() => {
'id': id,
'name': name,
'email': email,
'role': role,
};
}