

import 'package:glowwheels/models/service_boy_response.dart';
import 'package:glowwheels/models/serviceboy_model.dart';

class ServiceBoyResponse {
  final String id;
  final String shopId;
  final List<ServiceBoy> serviceBoy;
  final String createdAt;
  final String updatedAt;

  ServiceBoyResponse({
    required this.id,
    required this.shopId,
    required this.serviceBoy,
    required this.createdAt,
    required this.updatedAt,
  });

  factory ServiceBoyResponse.fromJson(Map<String, dynamic> json) {
    return ServiceBoyResponse(
      id: json['_id'],
      shopId: json['shopId'],
      serviceBoy: (json['serviceBoy'] as List)
          .map((e) => ServiceBoy.fromJson(e))
          .toList(),
      createdAt: json['createdAt'],
      updatedAt: json['updatedAt'],
    );
  }

  Map<String, dynamic> toJson() {
    return {
      '_id': id,
      'shopId': shopId,
      'serviceBoy': serviceBoy.map((e) => e.toJson()).toList(),
      'createdAt': createdAt,
      'updatedAt': updatedAt,
    };
  }
}
