import 'dart:convert'; class OutletResponse { final bool? success; final OutletData? data; final dynamic errors; OutletResponse({ this.success, this.data, this.errors, }); factory OutletResponse.fromJson(String str) => OutletResponse.fromMap(json.decode(str)); String toJson() => json.encode(toMap()); factory OutletResponse.fromMap(Map json) => OutletResponse( success: json["success"], data: json["data"] == null ? null : OutletData.fromMap(json["data"]), errors: json["errors"], ); Map toMap() => { "success": success, "data": data?.toMap(), "errors": errors, }; } class OutletDetailResponse { final bool? success; final Outlet? data; final dynamic errors; OutletDetailResponse({ this.success, this.data, this.errors, }); factory OutletDetailResponse.fromJson(String str) => OutletDetailResponse.fromMap(json.decode(str)); String toJson() => json.encode(toMap()); factory OutletDetailResponse.fromMap(Map json) => OutletDetailResponse( success: json["success"], data: json["data"] == null ? null : Outlet.fromMap(json["data"]), errors: json["errors"], ); Map toMap() => { "success": success, "data": data?.toMap(), "errors": errors, }; } class OutletData { final List? outlets; final int? totalCount; final int? page; final int? limit; final int? totalPages; OutletData({ this.outlets, this.totalCount, this.page, this.limit, this.totalPages, }); factory OutletData.fromMap(Map json) => OutletData( outlets: json["outlets"] == null ? [] : List.from(json["outlets"].map((x) => Outlet.fromMap(x))), totalCount: json["total_count"], page: json["page"], limit: json["limit"], totalPages: json["total_pages"], ); Map toMap() => { "outlets": outlets == null ? [] : List.from(outlets!.map((x) => x.toMap())), "total_count": totalCount, "page": page, "limit": limit, "total_pages": totalPages, }; } class Outlet { final String? id; final String? organizationId; final String? name; final String? address; final String? phoneNumber; final String? businessType; final String? currency; final int? taxRate; final bool? isActive; final DateTime? createdAt; final DateTime? updatedAt; Outlet({ this.id, this.organizationId, this.name, this.address, this.phoneNumber, this.businessType, this.currency, this.taxRate, this.isActive, this.createdAt, this.updatedAt, }); factory Outlet.fromMap(Map json) => Outlet( id: json["id"], organizationId: json["organization_id"], name: json["name"], address: json["address"], phoneNumber: json["phone_number"], businessType: json["business_type"], currency: json["currency"], taxRate: json["tax_rate"], isActive: json["is_active"], 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, "address": address, "phone_number": phoneNumber, "business_type": businessType, "currency": currency, "tax_rate": taxRate, "is_active": isActive, "created_at": createdAt?.toIso8601String(), "updated_at": updatedAt?.toIso8601String(), }; factory Outlet.fromJson(String str) => Outlet.fromMap(json.decode(str)); String toJson() => json.encode(toMap()); }