import 'dart:convert';

class ProviderSubscriptionModel {
  int? id;
  int? subscriptionAppliedId;
  int? serviceProviderId;
  String? subscriptionName;
  String? subscriptionDescription;
  DateTime? dateStart;
  DateTime? dateEnd;
  int? branchesRemaining;
  int? subUsersRemaining;
  int? subscriptionID;
  int? adsRemaining;
  bool? isExpired;
  bool? isActive;
  bool? isUpgradeNow;
  bool? isUpgradeLater;
  bool? isTrialSubscription;
  dynamic currentSubscription;
  int? totalBranches;
  int? totalSubUsers;
  int? totalAds;


  ProviderSubscriptionModel({
    this.id,
    this.subscriptionAppliedId,
    this.serviceProviderId,
    this.subscriptionName,
    this.subscriptionDescription,
    this.dateStart,
    this.dateEnd,
    this.branchesRemaining,
    this.subUsersRemaining,
    this.adsRemaining,
    this.isExpired,
    this.isActive,
    this.isUpgradeNow,
    this.isUpgradeLater,
    this.isTrialSubscription,
    this.currentSubscription,
    this.subscriptionID,
    this.totalAds,
    this.totalBranches,
    this.totalSubUsers,
  });

  factory ProviderSubscriptionModel.fromRawJson(String str) => ProviderSubscriptionModel.fromJson(json.decode(str));

  String toRawJson() => json.encode(toJson());

  factory ProviderSubscriptionModel.fromJson(Map<String, dynamic> json) => ProviderSubscriptionModel(
        id: json["id"],
        subscriptionAppliedId: json["subscriptionAppliedID"],
        serviceProviderId: json["serviceProviderID"],
        subscriptionID: json["subscriptionID"],
        subscriptionName: json["subscriptionName"],
        subscriptionDescription: json["subscriptionDescription"],
        dateStart: json["dateStart"] == null ? null : DateTime.parse(json["dateStart"]),
        dateEnd: json["dateEnd"] == null ? null : DateTime.parse(json["dateEnd"]),
        branchesRemaining: json["branchesRemaining"],
        subUsersRemaining: json["subUsersRemaining"],
        adsRemaining: json["adsRemaining"],
        isExpired: json["isExpired"],
        isActive: json["isActive"],
        isUpgradeNow: json["isUpgradeNow"],
        isUpgradeLater: json["isUpgradeLater"],
        isTrialSubscription: json["isTrialSubscription"],
        currentSubscription: json["currentSubscription"],
        totalBranches: json["totalBranches"],
        totalAds: json["totalAds"],
        totalSubUsers: json["totalSubUsers"],
      );

  Map<String, dynamic> toJson() => {
        "id": id,
        "subscriptionAppliedID": subscriptionAppliedId,
        "serviceProviderID": serviceProviderId,
        "subscriptionID": subscriptionID,
        "subscriptionName": subscriptionName,
        "subscriptionDescription": subscriptionDescription,
        "dateStart": dateStart?.toIso8601String(),
        "dateEnd": dateEnd?.toIso8601String(),
        "branchesRemaining": branchesRemaining,
        "subUsersRemaining": subUsersRemaining,
        "adsRemaining": adsRemaining,
        "isExpired": isExpired,
        "isActive": isActive,
        "isUpgradeNow": isUpgradeNow,
        "isUpgradeLater": isUpgradeLater,
        "isTrialSubscription": isTrialSubscription,
        "currentSubscription": currentSubscription,
        "totalAds": totalAds,
        "totalSubUsers": totalSubUsers,
        "totalBranches": totalBranches,
      };
}
