import 'package:json_annotation/json_annotation.dart';

import '../converters/flag_converter.dart';
import 'property_event.dart';

part '../../../_generated/data/remote/models/property_area.g.dart';

@JsonSerializable(fieldRename: FieldRename.snake)
class PropertyArea {
  final int id;
  final String name;
  final String pickupText;
  final String deliveryText;
  @FlagConverter()
  final bool isOpen;
  @FlagConverter()
  final bool isMeetingArea;
  @FlagConverter()
  final bool isGuestArea;
  @FlagConverter()
  final bool isPrearrivalArea;
  final String theme;
  final String icon;
  @JsonKey(defaultValue: 0)
  final int deliveryPrice;
  @FlagConverter()
  final bool isDeliveryDefault;
  @FlagConverter()
  final bool hasDelivery;
  final List<PropertyEvent> events;
  final bool skipLocation;

  const PropertyArea({
    required this.id,
    required this.name,
    required this.pickupText,
    required this.deliveryText,
    required this.isOpen,
    required this.isMeetingArea,
    required this.isGuestArea,
    required this.isPrearrivalArea,
    required this.theme,
    required this.icon,
    required this.deliveryPrice,
    required this.isDeliveryDefault,
    required this.hasDelivery,
    required this.events,
    required this.skipLocation,
  });

  factory PropertyArea.fromJson(Map<String, dynamic> json) => _$PropertyAreaFromJson(json);

  Map<String, dynamic> toJson() => _$PropertyAreaToJson(this);
}