content: import 'dart:convert';
  
  import '../../../domain/entities/category/category.dart';
  
  List<CategoryModel> categoryModelListFromRemoteJson(String str) =>
      List<CategoryModel>.from(
          json.decode(str)['data'].map((x) => CategoryModel.fromJson(x)));
  
  List<CategoryModel> categoryModelListFromLocalJson(String str) =>
      List<CategoryModel>.from(
          json.decode(str).map((x) => CategoryModel.fromJson(x)));
  
  String categoryModelListToJson(List<CategoryModel> data) =>
      json.encode(List<dynamic>.from(data.map((x) => x.toJson())));
  
  class CategoryModel extends Category {
    const CategoryModel({
      required super.id,
      required super.name,
      required super.image,
    });
  
    factory CategoryModel.fromJson(Map<String, dynamic> json) => CategoryModel(
          id: json["_id"],
          name: json["name"],
          image: json["image"],
        );
  
    Map<String, dynamic> toJson() => {
          "_id": id,
          "name": name,
          "image": image,
        };
  
    factory CategoryModel.fromEntity(Category entity) => CategoryModel(
          id: entity.id,
          name: entity.name,
          image: entity.image,
        );
  }
  