class VendorServiceUploadModel {
  final String id;
  final String vendorName;
  final String serviceName;
  final String serviceType;
  final String category;
  final String subcategory;
  final String workingHours;
  final String workingDuration;
  final double amount;
  final String location;
  final String? description;
  final String details;
  final List<String> images; // This will store image URLs after upload
  final List<String> videos; // YouTube video links

  VendorServiceUploadModel({
    required this.id,
    required this.vendorName,
    required this.serviceName,
    required this.serviceType,
    required this.category,
    required this.subcategory,
    required this.workingHours,
    required this.workingDuration,
    required this.amount,
    required this.location,
    this.description,
    required this.details,
    required this.images,
    required this.videos,
  });

  Map<String, dynamic> toJson() {
    return {
      'id': id,
      'vendorName': vendorName,
      'serviceName': serviceName,
      'serviceType': serviceType,
      'category': category,
      'subcategory': subcategory,
      'workingHours': workingHours,
      'workingDuration': workingDuration,
      'amount': amount,
      'location': location,
      'description': description,
      'details': details,
      'images': images,
      'videos': videos,
    };
  }

  factory VendorServiceUploadModel.fromJson(Map<String, dynamic> json) {
    return VendorServiceUploadModel(
      id: json['id'] as String,
      vendorName: json['vendorName'] as String,
      serviceName: json['serviceName'] as String,
      serviceType: json['serviceType'] as String,
      category: json['category'] as String,
      subcategory: json['subcategory'] as String,
      workingHours: json['workingHours'] as String,
      workingDuration: json['workingDuration'] as String,
      amount:
          json['amount'] is int
              ? (json['amount'] as int).toDouble()
              : json['amount'] as double,
      location: json['location'] as String,
      description: json['description'] as String?,
      details: json['details'] as String,
      images: (json['images'] as List?)?.map((e) => e as String).toList() ?? [],
      videos: (json['videos'] as List?)?.map((e) => e as String).toList() ?? [],
    );
  }
}
