// To parse this JSON data, do
//
//     final branch2 = branch2FromJson(jsonString);

import 'dart:convert';

import 'package:mc_common_app/models/profile/categroy.dart';



Branch2 branch2FromJson(String str) => Branch2.fromJson(json.decode(str));

String branch2ToJson(Branch2 data) => json.encode(data.toJson());

class Branch2 {
  Branch2({
    this.messageStatus,
    this.totalItemsCount,
    this.data,
    this.message,
  });

  final int? messageStatus;
  final int? totalItemsCount;
  final Data? data;
  final String? message;

  factory Branch2.fromJson(Map<String, dynamic> json) => Branch2(
        messageStatus: json["messageStatus"] == null ? null : json["messageStatus"],
        totalItemsCount: json["totalItemsCount"] == null ? null : json["totalItemsCount"],
        data: json["data"] == null ? null : Data.fromJson(json["data"]),
        message: json["message"] == null ? null : json["message"],
      );

  Map<String, dynamic> toJson() => {
        "messageStatus": messageStatus == null ? null : messageStatus,
        "totalItemsCount": totalItemsCount == null ? null : totalItemsCount,
        "data": data == null ? null : data!.toJson(),
        "message": message == null ? null : message,
      };
}

class Data {
  Data({
    this.id,
    this.companyName,
    this.countryName,
    this.companyDescription,
    this.allDocStatus,
    this.isValidSubscription,
    this.userId,
    this.serviceProviderBranch,
    this.countryID,
  });

  final int? id;
  final String? companyName;
  final String? countryName;
  int? countryID;
  final String? companyDescription;
  final int? allDocStatus;
  final bool? isValidSubscription;
  final String? userId;
  final List<ServiceProviderBranch>? serviceProviderBranch;

  factory Data.fromJson(Map<String, dynamic> json) => Data(
        id: json["id"] == null ? null : json["id"],
        companyName: json["companyName"] == null ? null : json["companyName"],
        countryName: json["countryName"] == null ? null : json["countryName"],
        countryID: json["countryID"] == null ? null : json["countryID"],
        companyDescription: json["companyDescription"] == null ? null : json["companyDescription"],
        allDocStatus: json["allDocStatus"] == null ? null : json["allDocStatus"],
        isValidSubscription: json["isValidSubscription"] == null ? null : json["isValidSubscription"],
        userId: json["userID"] == null ? null : json["userID"],
        serviceProviderBranch: json["serviceProviderBranch"] == null ? null : List<ServiceProviderBranch>.from(json["serviceProviderBranch"].map((x) => ServiceProviderBranch.fromJson(x))),
      );

  Map<String, dynamic> toJson() => {
        "id": id == null ? null : id,
        "companyName": companyName == null ? null : companyName,
        "companyDescription": companyDescription == null ? null : companyDescription,
        "allDocStatus": allDocStatus == null ? null : allDocStatus,
        "isValidSubscription": isValidSubscription == null ? null : isValidSubscription,
        "userID": userId == null ? null : userId,
        "serviceProviderBranch": serviceProviderBranch == null ? null : List<dynamic>.from(serviceProviderBranch!.map((x) => x.toJson())),
      };
}

class ServiceProviderBranch {
  ServiceProviderBranch({
    this.id,
    this.cityId,
    this.cityName,
    this.branchName,
    this.branchDescription,
    this.address,
    this.latitude,
    this.longitude,
    this.status,
    this.serviceProviderServices,
    this.countryID,
    this.countryName,
    this.categories,
  });

  final int? id;
  int? countryID;
  String? countryName;
  final int? cityId;
  final dynamic? cityName;
  final String? branchName;
  final String? branchDescription;
  final String? address;
  final String? latitude;
  final String? longitude;
  final int? status;
  final List<ServiceProviderService>? serviceProviderServices;
  List<CategoryData>? categories;

  factory ServiceProviderBranch.fromJson(Map<String, dynamic> json) => ServiceProviderBranch(
        id: json["id"] == null ? null : json["id"],
        countryID: 0,
        countryName: "",
        cityId: json["cityID"] == null ? null : json["cityID"],
        cityName: json["cityName"],
        branchName: json["branchName"] == null ? null : json["branchName"],
        branchDescription: json["branchDescription"] == null ? null : json["branchDescription"],
        address: json["address"] == null ? null : json["address"],
        latitude: json["latitude"] == null ? null : json["latitude"],
        longitude: json["longitude"] == null ? null : json["longitude"],
        status: json["status"] == null ? null : json["status"],
        serviceProviderServices: json["serviceProviderServices"] == null ? null : List<ServiceProviderService>.from(json["serviceProviderServices"].map((x) => ServiceProviderService.fromJson(x))),
        categories: [],
      );

  Map<String, dynamic> toJson() => {
        "id": id == null ? null : id,
        "cityID": cityId == null ? null : cityId,
        "cityName": cityName,
        "branchName": branchName == null ? null : branchName,
        "branchDescription": branchDescription == null ? null : branchDescription,
        "address": address == null ? null : address,
        "latitude": latitude == null ? null : latitude,
        "longitude": longitude == null ? null : longitude,
        "status": status == null ? null : status,
        "serviceProviderServices": serviceProviderServices == null ? null : List<dynamic>.from(serviceProviderServices!.map((x) => x.toJson())),
      };
}

class ServiceProviderService {
  ServiceProviderService({
    this.serviceId,
    this.serviceName,
    this.serviceNameN,
    this.categoryId,
    this.categoryName,
    this.serviceStatus,
  });

  final int? serviceId;
  final String? serviceName;
  final String? serviceNameN;
  final int? categoryId;
  final String? categoryName;
  final int? serviceStatus;

  factory ServiceProviderService.fromJson(Map<String, dynamic> json) => ServiceProviderService(
        serviceId: json["serviceID"] == null ? null : json["serviceID"],
        serviceName: json["serviceName"] == null ? null : json["serviceName"],
        serviceNameN: json["serviceNameN"] == null ? null : json["serviceNameN"],
        categoryId: json["categoryID"] == null ? null : json["categoryID"],
        categoryName: json["categoryName"] == null ? null : json["categoryName"],
        serviceStatus: json["serviceStatus"] == null ? null : json["serviceStatus"],
      );

  Map<String, dynamic> toJson() => {
        "serviceID": serviceId == null ? null : serviceId,
        "serviceName": serviceName == null ? null : serviceName,
        "serviceNameN": serviceNameN == null ? null : serviceNameN,
        "categoryID": categoryId == null ? null : categoryId,
        "categoryName": categoryName == null ? null : categoryName,
        "serviceStatus": serviceStatus == null ? null : serviceStatus,
      };
}
