


class CreateTemporaryPasswordModel{
  final String name;
  late final String password;
  late final String effectiveTime;
  late final String invalidTime;
   List<Schedule>? scheduleList;

  CreateTemporaryPasswordModel({
    required this.name,
    required this.password,
    required this.effectiveTime,
    required this.invalidTime,
    this.scheduleList,
  });

  factory CreateTemporaryPasswordModel.fromJson(Map<String, dynamic> json) {
    return CreateTemporaryPasswordModel(
      name: json['name'],
      password: json['password'],
      effectiveTime: json['effectiveTime'],
      invalidTime: json['invalidTime'],
      scheduleList: (json['scheduleList'] as List)
          .map((i) => Schedule.fromJson(i))
          .toList(),
    );
  }

  Map<String, dynamic> toJson() {
    return {
      'name': name,
      'password': password,
      'effectiveTime': effectiveTime,
      'invalidTime': invalidTime,
      'scheduleList': scheduleList!.map((i) => i.toJson()).toList(),
    };
  }
}

class Schedule {
  final String effectiveTime;
  final String invalidTime;
  final List<String> workingDay;

  Schedule({
    required this.effectiveTime,
    required this.invalidTime,
    required this.workingDay,
  });

  factory Schedule.fromJson(Map<String, dynamic> json) {
    return Schedule(
      effectiveTime: json['effectiveTime'],
      invalidTime: json['invalidTime'],
      workingDay: List<String>.from(json['workingDay']),
    );
  }

  Map<String, dynamic> toJson() {
    return {
      'effectiveTime': effectiveTime,
      'invalidTime': invalidTime,
      'workingDay': workingDay,
    };
  }
}
