import 'package:domain/generated/json/base/json_convert_content.dart';
import 'package:domain/entity/response/labour_review_status_entity.dart';

LabourReviewStatusEntity $LabourReviewStatusEntityFromJson(Map<String, dynamic> json) {
  final LabourReviewStatusEntity labourReviewStatusEntity = LabourReviewStatusEntity();
  final int? coDepartmentId = jsonConvert.convert<int>(json['co_department_id']);
  if (coDepartmentId != null) {
    labourReviewStatusEntity.coDepartmentId = coDepartmentId;
  }
  final List<LabourReviewStatusRecords>? records = (json['records'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<LabourReviewStatusRecords>(e) as LabourReviewStatusRecords).toList();
  if (records != null) {
    labourReviewStatusEntity.records = records;
  }
  return labourReviewStatusEntity;
}

Map<String, dynamic> $LabourReviewStatusEntityToJson(LabourReviewStatusEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['co_department_id'] = entity.coDepartmentId;
  data['records'] = entity.records.map((v) => v.toJson()).toList();
  return data;
}

extension LabourReviewStatusEntityExtension on LabourReviewStatusEntity {
  LabourReviewStatusEntity copyWith({
    int? coDepartmentId,
    List<LabourReviewStatusRecords>? records,
  }) {
    return LabourReviewStatusEntity()
      ..coDepartmentId = coDepartmentId ?? this.coDepartmentId
      ..records = records ?? this.records;
  }
}

LabourReviewStatusRecords $LabourReviewStatusRecordsFromJson(Map<String, dynamic> json) {
  final LabourReviewStatusRecords labourReviewStatusRecords = LabourReviewStatusRecords();
  final String? serialNumber = jsonConvert.convert<String>(json['serial_number']);
  if (serialNumber != null) {
    labourReviewStatusRecords.serialNumber = serialNumber;
  }
  final String? nodeName = jsonConvert.convert<String>(json['node_name']);
  if (nodeName != null) {
    labourReviewStatusRecords.nodeName = nodeName;
  }
  final String? statusShow = jsonConvert.convert<String>(json['status_show']);
  if (statusShow != null) {
    labourReviewStatusRecords.statusShow = statusShow;
  }
  final String? auditName = jsonConvert.convert<String>(json['audit_name']);
  if (auditName != null) {
    labourReviewStatusRecords.auditName = auditName;
  }
  final String? auditTime = jsonConvert.convert<String>(json['audit_time']);
  if (auditTime != null) {
    labourReviewStatusRecords.auditTime = auditTime;
  }
  final String? auditMark = jsonConvert.convert<String>(json['audit_mark']);
  if (auditMark != null) {
    labourReviewStatusRecords.auditMark = auditMark;
  }
  final String? createdAt = jsonConvert.convert<String>(json['created_at']);
  if (createdAt != null) {
    labourReviewStatusRecords.createdAt = createdAt;
  }
  final String? assigneeTypeShow = jsonConvert.convert<String>(json['assignee_type_show']);
  if (assigneeTypeShow != null) {
    labourReviewStatusRecords.assigneeTypeShow = assigneeTypeShow;
  }
  final String? designationShow = jsonConvert.convert<String>(json['designation_show']);
  if (designationShow != null) {
    labourReviewStatusRecords.designationShow = designationShow;
  }
  return labourReviewStatusRecords;
}

Map<String, dynamic> $LabourReviewStatusRecordsToJson(LabourReviewStatusRecords entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['serial_number'] = entity.serialNumber;
  data['node_name'] = entity.nodeName;
  data['status_show'] = entity.statusShow;
  data['audit_name'] = entity.auditName;
  data['audit_time'] = entity.auditTime;
  data['audit_mark'] = entity.auditMark;
  data['created_at'] = entity.createdAt;
  data['assignee_type_show'] = entity.assigneeTypeShow;
  data['designation_show'] = entity.designationShow;
  return data;
}

extension LabourReviewStatusRecordsExtension on LabourReviewStatusRecords {
  LabourReviewStatusRecords copyWith({
    String? serialNumber,
    String? nodeName,
    String? statusShow,
    String? auditName,
    String? auditTime,
    String? auditMark,
    String? createdAt,
    String? assigneeTypeShow,
    String? designationShow,
  }) {
    return LabourReviewStatusRecords()
      ..serialNumber = serialNumber ?? this.serialNumber
      ..nodeName = nodeName ?? this.nodeName
      ..statusShow = statusShow ?? this.statusShow
      ..auditName = auditName ?? this.auditName
      ..auditTime = auditTime ?? this.auditTime
      ..auditMark = auditMark ?? this.auditMark
      ..createdAt = createdAt ?? this.createdAt
      ..assigneeTypeShow = assigneeTypeShow ?? this.assigneeTypeShow
      ..designationShow = designationShow ?? this.designationShow;
  }
}