class RoleModel {
  RoleModel({
    required this.id,
    required this.createdAt,
    required this.updatedAt,
    required this.name,
    required this.value,
    required this.remark,
    required this.status,
    required this.roleDefault,
  });

  final int? id;
  final DateTime? createdAt;
  final DateTime? updatedAt;
  final String? name;
  final String? value;
  final String? remark;
  final int? status;
  final dynamic roleDefault;

  factory RoleModel.fromJson(Map<String, dynamic> json) {
    return RoleModel(
      id: json["id"],
      createdAt: DateTime.tryParse(json["createdAt"] ?? ""),
      updatedAt: DateTime.tryParse(json["updatedAt"] ?? ""),
      name: json["name"],
      value: json["value"],
      remark: json["remark"],
      status: json["status"],
      roleDefault: json["default"],
    );
  }

  Map<String, dynamic> toJson() => {
        "id": id,
        "createdAt": createdAt?.toIso8601String(),
        "updatedAt": updatedAt?.toIso8601String(),
        "name": name,
        "value": value,
        "remark": remark,
        "status": status,
        "default": roleDefault,
      };
}
