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

LabourRequestWorkFlowEntity $LabourRequestWorkFlowEntityFromJson(Map<String, dynamic> json) {
  final LabourRequestWorkFlowEntity labourRequestWorkFlowEntity = LabourRequestWorkFlowEntity();
  final String? coDepartmentId = jsonConvert.convert<String>(json['co_department_id']);
  if (coDepartmentId != null) {
    labourRequestWorkFlowEntity.coDepartmentId = coDepartmentId;
  }
  final List<LabourRequestWorkFlowRecords>? records = (json['records'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<LabourRequestWorkFlowRecords>(e) as LabourRequestWorkFlowRecords).toList();
  if (records != null) {
    labourRequestWorkFlowEntity.records = records;
  }
  return labourRequestWorkFlowEntity;
}

Map<String, dynamic> $LabourRequestWorkFlowEntityToJson(LabourRequestWorkFlowEntity 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 LabourRequestWorkFlowEntityExtension on LabourRequestWorkFlowEntity {
  LabourRequestWorkFlowEntity copyWith({
    String? coDepartmentId,
    List<LabourRequestWorkFlowRecords>? records,
  }) {
    return LabourRequestWorkFlowEntity()
      ..coDepartmentId = coDepartmentId ?? this.coDepartmentId
      ..records = records ?? this.records;
  }
}

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

Map<String, dynamic> $LabourRequestWorkFlowRecordsToJson(LabourRequestWorkFlowRecords 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 LabourRequestWorkFlowRecordsExtension on LabourRequestWorkFlowRecords {
  LabourRequestWorkFlowRecords copyWith({
    int? serialNumber,
    String? nodeName,
    String? statusShow,
    String? auditName,
    String? auditTime,
    String? auditMark,
    String? createdAt,
    String? assigneeTypeShow,
    String? designationShow,
  }) {
    return LabourRequestWorkFlowRecords()
      ..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;
  }
}