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

class DepartmentModel extends Base {
  final int? id;
  final String? departmentName;
  final String? departmentCode;
  final String? ntCode;
  final String? operationalHours;

  DepartmentModel({
    this.id,
    this.departmentName,
    this.departmentCode,
    this.ntCode,
    this.operationalHours,
  }) : super(name: departmentName, identifier: id?.toString());

  factory DepartmentModel.fromJson(Map<String, dynamic> json) {
    return DepartmentModel(
      id: json['id'],
      departmentName: json['departmentName']??json['name'],
      departmentCode: json['departmentCode'],
      ntCode: json['ntCode'],
      operationalHours: json['operationalHours'],
    );
  }

  Map<String, dynamic> toJson() {
    return {
      'id': id,
      'departmentName': departmentName,
      'departmentCode': departmentCode,
      'ntCode': ntCode,
      'operationalHours': operationalHours,
    };
  }
}
