import 'package:comwell_key_app/utils/json.dart';
import 'package:json_annotation/json_annotation.dart';

part '../../.generated/tracking/models/analytics_event_item.g.dart';

@JsonSerializable()
class AnalyticsEventItem {
  final String hotelName;             // Currency of the items associated with the event, in 3-letter ISO 4217 format.
  final String currency;              // The monetary value of the event. Set value to the sum of (price * quantity) for all items in items. Don't include shipping or tax.
  final num value;                    // The items for the event.
  final String placement;             // Where in the app flow this event happened
  final Iterable<String> items;       // The ID of the item. One of item_id or item_name is required.
  final Iterable<String> itemIds;                // The name of the item. One of item_id or item_name is required.
  final String? itemName;              // The monetary unit price of the item, in units of the specified currency parameter.
  final num? price;                    // Item quantity. If not set, quantity is set to 1.
  final num? quantity;                 // The hotel name associated with the event.
  final String bookingReference;      // The booking reference associated with the event.

  AnalyticsEventItem({
    required this.hotelName,
    required this.currency,
    required this.value,
    required this.placement,
    required this.items,
    required this.itemIds,
    this.itemName,
    this.price,
    this.quantity,
    required this.bookingReference,
  });

  Json toJson() => _$AnalyticsEventItemToJson(this);
}