class PermisosModel {
  PermisosModel({
    this.result,
    this.response,
    this.message,
  });

  List<Result>? result;
  bool? response;
  String? message;

  factory PermisosModel.fromJson(Map<String, dynamic> json) => PermisosModel(
    result: List<Result>.from(json["result"].map((x) => Result.fromJson(x))),
    response: json["response"],
    message: json["message"],
  );

  Map<String, dynamic> toJson() => {
    "result": List<dynamic>.from(result!.map((x) => x.toJson())),
    "response": response,
    "message": message,
  };
}

class Result {
  Result({
    this.tipo,
    this.ides,
    this.idse,
    this.idca,
  });

  Tipo? tipo;
  String? ides;
  String? idse;
  String? idca;

  factory Result.fromJson(Map<String, dynamic> json) => Result(
    tipo: tipoValues.map![json["TIPO"]],
    ides: json["IDES"],
    idse: json["IDSE"],
    idca: json["IDCA"],
  );

  Map<String, dynamic> toJson() => {
    "TIPO": tipoValues.reverse[tipo],
    "IDES": ides,
    "IDSE": idse,
    "IDCA": idca,
  };
}

enum Tipo { ESTA, SECC, CATE }

final tipoValues = EnumValues({
  "CATE": Tipo.CATE,
  "ESTA": Tipo.ESTA,
  "SECC": Tipo.SECC
});

class EnumValues<T> {
  Map<String, T>? map;
  Map<T, String>? reverseMap;

  EnumValues(this.map);

  Map<T, String> get reverse {
    reverseMap ??= map!.map((k, v) => MapEntry(v, k));
    return reverseMap!;
  }
}