class Place {
  final String id;
  final String tripId;
  final int dayNumber;
  final String? name;
  final double latitude;
  final double longitude;
  final int? arrivalTimeUtc;
  final int? departureTimeUtc;
  final String? description;

  Place({
    required this.id,
    required this.tripId,
    required this.dayNumber,
    this.name,
    required this.latitude,
    required this.longitude,
    this.arrivalTimeUtc,
    this.departureTimeUtc,
    this.description,
  });

  Map<String, dynamic> toMap() {
    return {
      'id': id,
      'tripId': tripId,
      'dayNumber': dayNumber,
      'name': name,
      'latitude': latitude,
      'longitude': longitude,
      'arrivalTimeUtc': arrivalTimeUtc,
      'departureTimeUtc': departureTimeUtc,
      'description': description,
    };
  }

  factory Place.fromMap(Map<String, dynamic> map) {
    return Place(
      id: map['id'] as String,
      tripId: map['tripId'] as String,
      dayNumber: map['dayNumber'] as int,
      name: map['name'] as String?,
      latitude: map['latitude'] as double,
      longitude: map['longitude'] as double,
      arrivalTimeUtc: map['arrivalTimeUtc'] as int?,
      departureTimeUtc: map['departureTimeUtc'] as int?,
      description: map['description'] as String?,
    );
  }
}
