class ShopProfileModel {
  final String id;
  final String name;
  final String description;
  final String address;
  final double latitude;
  final double longitude;
  final String phone;
  final String email;
  final String password;
  final String role;
  final List<String> images;
  final int rating;
  final DateTime timestamp;

  ShopProfileModel({
    required this.id,
    required this.name,
    required this.description,
    required this.address,
    required this.latitude,
    required this.longitude,
    required this.phone,
    required this.email,
    required this.password,
    required this.role,
    required this.images,
    required this.rating,
    required this.timestamp,
  });

  factory ShopProfileModel.fromJson(Map<String, dynamic> json) {
    return ShopProfileModel(
      id: json['_id'],
      name: json['name'],
      description: json['description'],
      address: json['address'],
      latitude: json['latitude'].toDouble(),
      longitude: json['longitude'].toDouble(),
      phone: json['phone'],
      email: json['email'],
      password: json['password'],
      role: json['role'],
      images: List<String>.from(json['images']),
      rating: json['rating'],
      timestamp: DateTime.parse(json['timestamp']),
    );
  }

  Map<String, dynamic> toJson() {
    return {
      '_id': id,
      'name': name,
      'description': description,
      'address': address,
      'latitude': latitude,
      'longitude': longitude,
      'phone': phone,
      'email': email,
      'password': password,
      'role': role,
      'images': images,
      'rating': rating,
      'timestamp': timestamp.toIso8601String(),
    };
  }
}
