import 'localized_content.dart';
class EventCategory {
const EventCategory({required this.name, required this.slug});
final String name;
final String slug;
}
class Event {
const Event({
required this.id,
required this.title,
required this.shortDescription,
required this.description,
required this.start,
required this.end,
this.allDay = false,
this.status = 'scheduled',
this.attendanceMode = 'offline',
this.imageUrl,
this.venueName,
this.street,
this.postalCode,
this.city,
this.latitude,
this.longitude,
this.organizerName,
this.organizerUrl,
this.websiteUrl,
this.ticketUrl,
this.onlineUrl,
this.sourceUrl,
this.free = false,
this.bookingRequired = false,
this.accessible = false,
this.priceMin,
this.priceMax,
this.currency = 'EUR',
this.categories = const [],
});
final String id;
final LocalizedContent title;
final LocalizedContent shortDescription;
final LocalizedContent description;
final DateTime start;
final DateTime end;
final bool allDay;
final String status;
final String attendanceMode;
final String? imageUrl;
final String? venueName;
final String? street;
final String? postalCode;
final String? city;
final double? latitude;
final double? longitude;
final String? organizerName;
final String? organizerUrl;
final String? websiteUrl;
final String? ticketUrl;
final String? onlineUrl;
final String? sourceUrl;
final bool free;
final bool bookingRequired;
final bool accessible;
final double? priceMin;
final double? priceMax;
final String currency;
final List<EventCategory> categories;
bool get cancelled => status == 'cancelled';
bool get postponed => status == 'postponed';
bool get soldOut => status == 'sold_out';
bool isOnDay(DateTime day) {
final startDay = DateTime(start.year, start.month, start.day);
final endDay = DateTime(end.year, end.month, end.day);
final target = DateTime(day.year, day.month, day.day);
return !target.isBefore(startDay) && !target.isAfter(endDay);
}
String get formattedAddress => [
street,
[postalCode, city].where((v) => v?.trim().isNotEmpty == true).join(' '),
].where((v) => v?.trim().isNotEmpty == true).join(', ');
bool get hasTickets => ticketUrl?.trim().isNotEmpty == true;
}

