class DeptModel {
  DeptModel({
    required this.id,
    required this.createdAt,
    required this.updatedAt,
    required this.name,
    required this.orderNo,
  });

  final int? id;
  final DateTime? createdAt;
  final DateTime? updatedAt;
  final String? name;
  final int? orderNo;

  factory DeptModel.fromJson(Map<String, dynamic> json) {
    return DeptModel(
      id: json["id"],
      createdAt: DateTime.tryParse(json["createdAt"] ?? ""),
      updatedAt: DateTime.tryParse(json["updatedAt"] ?? ""),
      name: json["name"],
      orderNo: json["orderNo"],
    );
  }

  Map<String, dynamic> toJson() => {
        "id": id,
        "createdAt": createdAt?.toIso8601String(),
        "updatedAt": updatedAt?.toIso8601String(),
        "name": name,
        "orderNo": orderNo,
      };
}
