import 'dart:developer';

import 'package:mc_common_app/main.dart';
import 'package:mc_common_app/models/chat_models/chat_message_model.dart';

class ProviderOffersModel {
  int? id;
  int? customerID;
  int? requestType;
  int? requestStatus;
  String? brand;
  String? model;
  int? year;
  bool? isNew;
  String? description;
  double? price;
  int? spOfferCount;
  List<ServiceProvidersOffers>? serviceProviders;

  ProviderOffersModel({
    this.id,
    this.customerID,
    this.requestType,
    this.requestStatus,
    this.brand,
    this.model,
    this.year,
    this.isNew,
    this.description,
    this.price,
    this.spOfferCount,
    this.serviceProviders,
  });

  ProviderOffersModel.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    customerID = json['customerID'];
    requestType = json['requestType'];
    requestStatus = json['requestStatus'];
    brand = json['brand'];
    model = json['model'];
    year = json['year'];
    isNew = json['isNew'];
    description = json['description'];
    price = json['price'];
    spOfferCount = json['spOfferCount'];
    if (json['serviceProviders'] != null) {
      serviceProviders = <ServiceProvidersOffers>[];
      json['serviceProviders'].forEach((v) {
        serviceProviders!.add(ServiceProvidersOffers.fromJson(v));
      });
    }
  }
}

class ServiceProvidersOffers {
  String? providerUserId;
  int? providerId;
  String? name;
  String? mobileNo;
  String? email;
  String? companyName;
  int? offerCount;
  List<ChatMessageModel>? chatMessages;

  ServiceProvidersOffers({this.providerId, this.name, this.mobileNo, this.email, this.companyName, this.offerCount, this.chatMessages, this.providerUserId});

  ServiceProvidersOffers.fromJson(Map<String, dynamic> json) {
    providerId = json['providerID'];
    providerUserId = json['providerUserID'];
    name = json['name'];
    mobileNo = json['mobileNo'];
    email = json['email'];
    companyName = json['companyName'];
    offerCount = json['offerCount'];
    chatMessages = [];
  }

  @override
  String toString() {
    return 'ServiceProvidersOffers{providerUserId: $providerUserId, providerId: $providerId, name: $name, mobileNo: $mobileNo, email: $email, companyName: $companyName, offerCount: $offerCount, chatMessages: $chatMessages}';
  }
}
