65 lines
1.2 KiB
Dart
65 lines
1.2 KiB
Dart
import 'package:json_annotation/json_annotation.dart';
|
|
import 'package:krow/features/shifts/data/models/event_tag.dart';
|
|
|
|
part 'event.g.dart';
|
|
|
|
@JsonSerializable(fieldRename: FieldRename.snake)
|
|
class Event {
|
|
String? id;
|
|
Business? business;
|
|
String? name;
|
|
String? date;
|
|
String? additionalInfo;
|
|
List<Addon>? addons;
|
|
List<EventTag>? tags;
|
|
|
|
|
|
Event({
|
|
this.business,
|
|
this.name,
|
|
this.date,
|
|
this.additionalInfo,
|
|
this.addons,
|
|
this.tags,
|
|
});
|
|
|
|
factory Event.fromJson(Map<String, dynamic> json) {
|
|
return _$EventFromJson(json);
|
|
}
|
|
|
|
Map<String, dynamic> toJson() => _$EventToJson(this);
|
|
}
|
|
|
|
@JsonSerializable(fieldRename: FieldRename.snake)
|
|
class Business {
|
|
String? name;
|
|
String? avatar;
|
|
|
|
Business({this.name, this.avatar});
|
|
|
|
factory Business.fromJson(Map<String, dynamic> json) {
|
|
return _$BusinessFromJson(json);
|
|
}
|
|
|
|
Map<String, dynamic> toJson() => _$BusinessToJson(this);
|
|
}
|
|
|
|
@JsonSerializable(fieldRename: FieldRename.snake)
|
|
class Addon {
|
|
String? name;
|
|
|
|
Addon({this.name});
|
|
|
|
factory Addon.fromJson(Map<String, dynamic> json) {
|
|
return Addon(
|
|
name: json['name'],
|
|
);
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
return {
|
|
'name': name,
|
|
};
|
|
}
|
|
}
|