import 'dart:convert'; class CustomerResponseModel { final bool? success; final CustomerData? data; final dynamic errors; CustomerResponseModel({ this.success, this.data, this.errors, }); factory CustomerResponseModel.fromJson(String str) => CustomerResponseModel.fromMap(json.decode(str)); String toJson() => json.encode(toMap()); factory CustomerResponseModel.fromMap(Map json) => CustomerResponseModel( success: json["success"], data: json["data"] == null ? null : CustomerData.fromMap(json["data"]), errors: json["errors"], ); Map toMap() => { "success": success, "data": data?.toMap(), "errors": errors, }; } class CustomerData { final List? customers; final int? totalCount; final int? page; final int? limit; final int? totalPages; CustomerData({ this.customers, this.totalCount, this.page, this.limit, this.totalPages, }); factory CustomerData.fromMap(Map json) => CustomerData( customers: json["data"] == null ? [] : List.from(json["data"].map((x) => Customer.fromMap(x))), totalCount: json["total_count"], page: json["page"], limit: json["limit"], totalPages: json["total_pages"], ); Map toMap() => { "data": customers == null ? [] : List.from(customers!.map((x) => x.toMap())), "total_count": totalCount, "page": page, "limit": limit, "total_pages": totalPages, }; } class Customer { final String? id; final String? organizationId; final String? name; final bool? isDefault; final bool? isActive; final Map? metadata; final DateTime? createdAt; final DateTime? updatedAt; Customer({ this.id, this.organizationId, this.name, this.isDefault, this.isActive, this.metadata, this.createdAt, this.updatedAt, }); factory Customer.fromMap(Map json) => Customer( id: json["id"], organizationId: json["organization_id"], name: json["name"], isDefault: json["is_default"], isActive: json["is_active"], metadata: json["metadata"] ?? {}, createdAt: json["created_at"] == null ? null : DateTime.parse(json["created_at"]), updatedAt: json["updated_at"] == null ? null : DateTime.parse(json["updated_at"]), ); Map toMap() => { "id": id, "organization_id": organizationId, "name": name, "is_default": isDefault, "is_active": isActive, "metadata": metadata, "created_at": createdAt?.toIso8601String(), "updated_at": updatedAt?.toIso8601String(), }; }