diff --git a/lib/models/model/provider_model.dart b/lib/models/model/provider_model.dart deleted file mode 100644 index a406509..0000000 --- a/lib/models/model/provider_model.dart +++ /dev/null @@ -1,87 +0,0 @@ -// To parse this JSON data, do -// -// final branch2 = branch2FromJson(jsonString); - -import 'dart:convert'; - -import 'package:mc_common_app/models/profile/categroy.dart'; -import 'package:mc_common_app/models/services/branch_model.dart'; - -ProviderModel branch2FromJson(String str) => ProviderModel.fromJson(json.decode(str)); - -String branch2ToJson(ProviderModel data) => json.encode(data.toJson()); - -class ProviderModel { - ProviderModel({ - this.messageStatus, - this.totalItemsCount, - this.data, - this.message, - }); - - final int? messageStatus; - final int? totalItemsCount; - final ProviderModelData? data; - final String? message; - - factory ProviderModel.fromJson(Map json) => ProviderModel( - messageStatus: json["messageStatus"] == null ? null : json["messageStatus"], - totalItemsCount: json["totalItemsCount"] == null ? null : json["totalItemsCount"], - data: json["data"] == null ? null : ProviderModelData.fromJson(json["data"]), - message: json["message"] == null ? null : json["message"], - ); - - Map toJson() => { - "messageStatus": messageStatus == null ? null : messageStatus, - "totalItemsCount": totalItemsCount == null ? null : totalItemsCount, - "data": data == null ? null : data!.toJson(), - "message": message == null ? null : message, - }; -} - -class ProviderModelData { - ProviderModelData({ - 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; - - factory ProviderModelData.fromJson(Map json) => ProviderModelData( - 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.from(json["serviceProviderBranch"].map((x) => BranchModel.fromJson(x))), - ); - - Map 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.from(serviceProviderBranch!.map((x) => x.toJson())), - }; -} - diff --git a/lib/models/services/branch_model.dart b/lib/models/provider_branches_models/branch_detail_model.dart similarity index 91% rename from lib/models/services/branch_model.dart rename to lib/models/provider_branches_models/branch_detail_model.dart index df56c35..8b93ec2 100644 --- a/lib/models/services/branch_model.dart +++ b/lib/models/provider_branches_models/branch_detail_model.dart @@ -1,7 +1,7 @@ -import 'package:mc_common_app/models/profile/categroy.dart'; +import 'package:mc_common_app/models/provider_branches_models/profile/categroy.dart'; import 'package:mc_common_app/models/services/service_model.dart'; -class BranchModel { +class BranchDetailModel { final int? id; final int? serviceProviderId; final String? serviceProviderName; @@ -20,7 +20,7 @@ class BranchModel { List? categories; bool isExpanded; - BranchModel({ + BranchDetailModel({ this.id, this.serviceProviderId, this.serviceProviderName, @@ -40,7 +40,7 @@ class BranchModel { required this.isExpanded, }); - factory BranchModel.fromJson(Map json) => BranchModel( + factory BranchDetailModel.fromJson(Map json) => BranchDetailModel( id: json["id"], serviceProviderId: json["serviceProviderID"], serviceProviderName: json["serviceProviderName"], diff --git a/lib/models/profile/branch.dart b/lib/models/provider_branches_models/profile/branch.dart similarity index 100% rename from lib/models/profile/branch.dart rename to lib/models/provider_branches_models/profile/branch.dart diff --git a/lib/models/profile/categroy.dart b/lib/models/provider_branches_models/profile/categroy.dart similarity index 96% rename from lib/models/profile/categroy.dart rename to lib/models/provider_branches_models/profile/categroy.dart index 0c7bf26..33feaae 100644 --- a/lib/models/profile/categroy.dart +++ b/lib/models/provider_branches_models/profile/categroy.dart @@ -5,7 +5,7 @@ import 'dart:convert'; import 'package:equatable/equatable.dart'; -import 'package:mc_common_app/models/model/provider_model.dart'; +import 'package:mc_common_app/models/provider_branches_models/provider_profile_model.dart'; import 'package:mc_common_app/models/services/service_model.dart'; Category categoryFromJson(String str) => Category.fromJson(json.decode(str)); diff --git a/lib/models/profile/document.dart b/lib/models/provider_branches_models/profile/document.dart similarity index 100% rename from lib/models/profile/document.dart rename to lib/models/provider_branches_models/profile/document.dart diff --git a/lib/models/profile/services.dart b/lib/models/provider_branches_models/profile/services.dart similarity index 52% rename from lib/models/profile/services.dart rename to lib/models/provider_branches_models/profile/services.dart index 1d3d7ec..d457b4d 100644 --- a/lib/models/profile/services.dart +++ b/lib/models/provider_branches_models/profile/services.dart @@ -23,18 +23,18 @@ class Services { factory Services.fromJson(Map json) => Services( - totalItemsCount: json["totalItemsCount"] == null ? null : json["totalItemsCount"], + totalItemsCount: json["totalItemsCount"], data: json["data"] == null ? null : List.from(json["data"].map((x) => ServicesData.fromJson(x))), - messageStatus: json["messageStatus"] == null ? null : json["messageStatus"], - message: json["message"] == null ? null : json["message"], + messageStatus: json["messageStatus"], + message: json["message"], ); Map toJson() => { - "totalItemsCount": totalItemsCount == null ? null : totalItemsCount, + "totalItemsCount": totalItemsCount, "data": data == null ? null : List.from(data!.map((x) => x.toJson())), - "messageStatus": messageStatus == null ? null : messageStatus, - "message": message == null ? null : message, + "messageStatus": messageStatus, + "message": message, }; } @@ -61,24 +61,24 @@ class ServicesData { factory ServicesData.fromJson(Map json) => ServicesData( - id: json["id"] == null ? null : json["id"], - description: json["description"] == null ? (json["serviceDescription"] == null ? null : json["serviceDescription"]) : json["description"], - descriptionN: json["descriptionN"] == null ? (json["serviceDescriptionN"] == null ? null : json["serviceDescriptionN"]) : json["descriptionN"], - serviceIconUrl: json["serviceIconUrl"] == null ? null : json["serviceIconUrl"], - serviceImageUrl: json["serviceImageUrl"] == null ? null : json["serviceImageUrl"], - serviceCategoryId: json["serviceCategoryID"] == null ? null : json["serviceCategoryID"], - categoryName: json["categoryName"] == null ? null : json["categoryName"], + id: json["id"], + description: json["description"] ?? (json["serviceDescription"]), + descriptionN: json["descriptionN"] ?? (json["serviceDescriptionN"]), + serviceIconUrl: json["serviceIconUrl"], + serviceImageUrl: json["serviceImageUrl"], + serviceCategoryId: json["serviceCategoryID"], + categoryName: json["categoryName"], isSelected: false, ); Map toJson() => { - "id": id == null ? null : id, - "description": description == null ? null : description, - "descriptionN": descriptionN == null ? null : descriptionN, + "id": id, + "description": description, + "descriptionN": descriptionN, "serviceIconUrl": serviceIconUrl, "serviceImageUrl": serviceImageUrl, - "serviceCategoryID": serviceCategoryId == null ? null : serviceCategoryId, + "serviceCategoryID": serviceCategoryId, "categoryName": categoryName, }; } diff --git a/lib/models/provider_branches_models/provider_profile_model.dart b/lib/models/provider_branches_models/provider_profile_model.dart new file mode 100644 index 0000000..10a845f --- /dev/null +++ b/lib/models/provider_branches_models/provider_profile_model.dart @@ -0,0 +1,53 @@ +// To parse this JSON data, do +// +// final branch2 = branch2FromJson(jsonString); + +import 'package:mc_common_app/models/provider_branches_models/branch_detail_model.dart'; + + +class ProviderProfileModel { + ProviderProfileModel({ + 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; + + factory ProviderProfileModel.fromJson(Map json) => ProviderProfileModel( + id: json["id"], + companyName: json["companyName"], + countryName: json["countryName"], + countryID: json["countryID"], + companyDescription: json["companyDescription"], + allDocStatus: json["allDocStatus"], + isValidSubscription: json["isValidSubscription"], + userId: json["userID"], + serviceProviderBranch: json["serviceProviderBranch"] == null ? null : List.from(json["serviceProviderBranch"].map((x) => BranchDetailModel.fromJson(x))), + ); + + Map toJson() => { + "id": id, + "companyName": companyName, + "companyDescription": companyDescription, + "allDocStatus": allDocStatus, + "isValidSubscription": isValidSubscription, + "userID": userId, + "serviceProviderBranch": serviceProviderBranch == null ? null : List.from(serviceProviderBranch!.map((x) => x.toJson())), + }; +} + diff --git a/lib/models/services/near_branch_model.dart b/lib/models/services/near_branch_model.dart deleted file mode 100644 index 93d9cd6..0000000 --- a/lib/models/services/near_branch_model.dart +++ /dev/null @@ -1,39 +0,0 @@ -// To parse this JSON data, do -// -// final nearBrancheModel = nearBrancheModelFromJson(jsonString); - -import 'dart:convert'; - -import 'branch_model.dart'; - -NearBrancheModel nearBrancheModelFromJson(String str) => NearBrancheModel.fromJson(json.decode(str)); - -String nearBrancheModelToJson(NearBrancheModel data) => json.encode(data.toJson()); - -class NearBrancheModel { - final int? messageStatus; - final int? totalItemsCount; - final List? data; - final String? message; - - NearBrancheModel({ - this.messageStatus, - this.totalItemsCount, - this.data, - this.message, - }); - - factory NearBrancheModel.fromJson(Map json) => NearBrancheModel( - messageStatus: json["messageStatus"], - totalItemsCount: json["totalItemsCount"], - data: json["data"] == null ? [] : List.from(json["data"]!.map((x) => BranchModel.fromJson(x))), - message: json["message"], - ); - - Map toJson() => { - "messageStatus": messageStatus, - "totalItemsCount": totalItemsCount, - "data": data == null ? [] : List.from(data!.map((x) => x.toJson())), - "message": message, - }; -}