import 'package:mc_common_app/models/provider_branches_models/branch_detail_model.dart';

class ProviderProfileModel {
  ProviderProfileModel({
    this.id,
    this.companyName,
    this.name,
    this.countryName,
    this.companyDescription,
    this.allDocStatus,
    this.isValidSubscription,
    this.userId,
    this.memberSince,
    this.serviceProviderBranch,
    this.countryID,
    this.isFavorite,
    this.providerID,
    this.noOfBranches,
    this.customerID,
  });

  final int? id;
  final String? companyName;
  final String? companyDescription;
  int? countryID;
  final String? countryName;
  final int? allDocStatus;
  final bool? isValidSubscription;
  final String? name;
  final String? userId;
  final String? memberSince;
  bool? isFavorite;
  final int? providerID;
  final int? customerID;
  final int? noOfBranches;
  final List<BranchDetailModel>? serviceProviderBranch;

  factory ProviderProfileModel.fromJson(Map<String, dynamic> json) => ProviderProfileModel(
        id: json["id"],
        companyName: json["companyName"],
        name: json["name"],
        countryName: json["countryName"],
        countryID: json["countryID"],
        companyDescription: json["companyDescription"],
        allDocStatus: json["allDocStatus"],
        isValidSubscription: json["isValidSubscription"],
        userId: json["userID"],
        memberSince: json["memberSince"] ?? "",
        providerID: json["providerID"] ?? 0,
        customerID: json["customerID"] ?? 0,
        noOfBranches: json["noOfBranches"] ?? (json["serviceProviderBranch"] != null ? (json["serviceProviderBranch"] as List).length : 0),
        isFavorite: json["isFavourite"] ?? false,
        serviceProviderBranch: json["serviceProviderBranch"] == null ? null : List<BranchDetailModel>.from(json["serviceProviderBranch"].map((x) => BranchDetailModel.fromJson(x))),
      );
}

// {
// "id": 10,
// "companyName": "string",
// "companyDescription": "",
// "countryID": 1,
// "countryName": "Saudi Arabia",
// "allDocStatus": 0,
// "isValidSubscription": true,
// "name": null,
// "userID": "88e2e2e8-9a6d-4f97-b05c-08dc7e4513b3",
// }
//
// {
// "id": 0,
// "companyName": "string",
// "companyDescription": "",
// "countryID": 1,
// "countryName": "string",
// "allDocStatus": 3,
// "isValidSubscription": true,
// "name": "Mirza Shafique",
// "userID": "7db5e1ae-6de4-47d7-984b-08db2842f899",
// "providerID": 2,
// "customerID": 6,
// "noOfBranches": 12,
// "memberSince": "2024-08-22T11:36:46.41"
// }
