import 'package:test_sa/models/base.dart';

class MedicalDepartmentModel extends Base {
  MedicalDepartmentModel(
      {this.departmentName, this.departmentCode, this.ntCode, this.costCenterNumber, this.costCenterName, this.name, this.id, this.createdBy, this.createdDate, this.modifiedBy, this.modifiedDate})
      : super(identifier: id?.toString() ?? '', name: departmentName); // Handle potential null id

  MedicalDepartmentModel.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    identifier = id?.toString() ?? '';
    name = json['departmentName'] ?? json['name'];
    departmentName = json['departmentName'] ?? json['name'];
    departmentCode = json['departmentCode'];
    ntCode = json['ntCode'];
    costCenterNumber = json['costCenterNumber'];
    costCenterName = json['costCenterName'];
    name = json['name'];
    createdBy = json['createdBy'];
    createdDate = json['createdDate'];
    modifiedBy = json['modifiedBy'];
    modifiedDate = json['modifiedDate'];
  }

  num? id; // Now nullable
  String? departmentName; // Now nullable
  String? departmentCode; // Now nullable
  String? ntCode;
  String? costCenterNumber;
  String? costCenterName;
  String? name;
  String? createdBy;
  String? createdDate;
  String? modifiedBy;
  String? modifiedDate;
}
