
import 'dart:convert';

import 'booking_time.dart';

class BookingDateTime {
  String? viewDate;
  int? unixTime;
  String? sendTimeTip;
  List<BookingTime>? bookTimes;

  BookingDateTime(this.viewDate, this.unixTime, this.sendTimeTip, this.bookTimes);

  BookingDateTime.fromJson(Map<String, dynamic> json)
    : viewDate = json['view_date'],
      unixTime = int.parse(json['unix_time'].toString()),
      sendTimeTip = json['send_time_tip'],
      bookTimes = (json['book_times'] as List).map((e) => BookingTime.fromJson(e)).toList();

  Map<String, dynamic> toJson() => {
    'view_date': viewDate,
    'unix_time': unixTime,
    'send_time_tip': sendTimeTip,
    'book_times': bookTimes,
  };

  @override
  String toString() {
    return json.encode(this);
  }

}