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

SignInSignOutEntity $SignInSignOutEntityFromJson(Map<String, dynamic> json) {
  final SignInSignOutEntity signInSignOutEntity = SignInSignOutEntity();
  final List<SignInSignOutRows>? rows = (json['rows'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<SignInSignOutRows>(e) as SignInSignOutRows).toList();
  if (rows != null) {
    signInSignOutEntity.rows = rows;
  }
  return signInSignOutEntity;
}

Map<String, dynamic> $SignInSignOutEntityToJson(SignInSignOutEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['rows'] = entity.rows?.map((v) => v.toJson()).toList();
  return data;
}

extension SignInSignOutEntityExtension on SignInSignOutEntity {
  SignInSignOutEntity copyWith({
    List<SignInSignOutRows>? rows,
  }) {
    return SignInSignOutEntity()
      ..rows = rows ?? this.rows;
  }
}

SignInSignOutRows $SignInSignOutRowsFromJson(Map<String, dynamic> json) {
  final SignInSignOutRows signInSignOutRows = SignInSignOutRows();
  final String? appliedId = jsonConvert.convert<String>(json['applied_id']);
  if (appliedId != null) {
    signInSignOutRows.appliedId = appliedId;
  }
  final String? staffName = jsonConvert.convert<String>(json['staff_name']);
  if (staffName != null) {
    signInSignOutRows.staffName = staffName;
  }
  final String? jobDate = jsonConvert.convert<String>(json['job_date']);
  if (jobDate != null) {
    signInSignOutRows.jobDate = jobDate;
  }
  final String? startTime = jsonConvert.convert<String>(json['start_time']);
  if (startTime != null) {
    signInSignOutRows.startTime = startTime;
  }
  final String? endTime = jsonConvert.convert<String>(json['end_time']);
  if (endTime != null) {
    signInSignOutRows.endTime = endTime;
  }
  final String? inTime = jsonConvert.convert<String>(json['in_time']);
  if (inTime != null) {
    signInSignOutRows.inTime = inTime;
  }
  final String? inPhoto = jsonConvert.convert<String>(json['in_photo']);
  if (inPhoto != null) {
    signInSignOutRows.inPhoto = inPhoto;
  }
  final String? outTime = jsonConvert.convert<String>(json['out_time']);
  if (outTime != null) {
    signInSignOutRows.outTime = outTime;
  }
  final String? outPhoto = jsonConvert.convert<String>(json['out_photo']);
  if (outPhoto != null) {
    signInSignOutRows.outPhoto = outPhoto;
  }
  final bool? isExpended = jsonConvert.convert<bool>(json['isExpended']);
  if (isExpended != null) {
    signInSignOutRows.isExpended = isExpended;
  }
  return signInSignOutRows;
}

Map<String, dynamic> $SignInSignOutRowsToJson(SignInSignOutRows entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['applied_id'] = entity.appliedId;
  data['staff_name'] = entity.staffName;
  data['job_date'] = entity.jobDate;
  data['start_time'] = entity.startTime;
  data['end_time'] = entity.endTime;
  data['in_time'] = entity.inTime;
  data['in_photo'] = entity.inPhoto;
  data['out_time'] = entity.outTime;
  data['out_photo'] = entity.outPhoto;
  data['isExpended'] = entity.isExpended;
  return data;
}

extension SignInSignOutRowsExtension on SignInSignOutRows {
  SignInSignOutRows copyWith({
    String? appliedId,
    String? staffName,
    String? jobDate,
    String? startTime,
    String? endTime,
    String? inTime,
    String? inPhoto,
    String? outTime,
    String? outPhoto,
    bool? isExpended,
  }) {
    return SignInSignOutRows()
      ..appliedId = appliedId ?? this.appliedId
      ..staffName = staffName ?? this.staffName
      ..jobDate = jobDate ?? this.jobDate
      ..startTime = startTime ?? this.startTime
      ..endTime = endTime ?? this.endTime
      ..inTime = inTime ?? this.inTime
      ..inPhoto = inPhoto ?? this.inPhoto
      ..outTime = outTime ?? this.outTime
      ..outPhoto = outPhoto ?? this.outPhoto
      ..isExpended = isExpended ?? this.isExpended;
  }
}