import 'package:freezed_annotation/freezed_annotation.dart';

part 'device_entity.freezed.dart';

@freezed
abstract class DeviceEntity with _$DeviceEntity {
  const factory DeviceEntity({
    required String id,
    required String identificator,
    int? battery,
    String? userId,
    String? companyId,
    String? delegationId,
    String? groupId,
    required DeviceFlagsEntity flags,
    List<String>? tags,
    int? lastConnection,
    String? carrierGenre,
    int? carrierBirthday,
    double? carrierWeight,
    double? carrierStepLength,
    required String carrierName,
    String? comment,
    String? phone,
    String? simId,
    String? simStatus,
    DevicePaymentOptionsEntity? paymentOptions,
    required DeviceSettingsEntity settings,
    required String protocol,
    required String type,
    required String connectionServer,
    DeviceCapabilitiesEntity? capabilities,
    required int createdAt,
    int? updatedAt,
  }) = _DeviceEntity;
}

@freezed
abstract class DeviceFlagsEntity with _$DeviceFlagsEntity{
  const factory DeviceFlagsEntity({
    required String isInOrOut,
    String? geofenceId,
    required bool isBatteryLow,
    required bool isDisconnect,
  }) = _DeviceFlagsEntity;
}

@freezed
abstract class DevicePaymentOptionsEntity with _$DevicePaymentOptionsEntity{
  const factory DevicePaymentOptionsEntity({
    int? nextPayDate,
    required bool usePayment,
    required String typeSubscription,
    required bool hasSubscription,
    required bool hasToPay,
  }) = _DevicePaymentOptionsEntity;
}

@freezed
abstract class DeviceSettingsEntity with _$DeviceSettingsEntity{
  const factory DeviceSettingsEntity({
    required int frequency,
    required int frequencyHeartRate,
    required int timezone,
    required bool pedometer,
    required String language,
    required List<String> alerts,
  }) = _DeviceSettingsEntity;
}

@freezed
abstract class DeviceCapabilitiesEntity with _$DeviceCapabilitiesEntity{
  const factory DeviceCapabilitiesEntity({
    required bool heartbeats,
    required bool bloodPressure,
    required DeviceCapabilitiesAlertEntity alerts,
    required bool podometer,
    required DeviceCapabilitiesContactsEntity contacts,
    required DeviceCapabilitiesCommandsEntity commands,
    required DeviceCapabilitiesSettingsEntity settings,
  }) = _DeviceCapabilitiesEntity;
}

@freezed
abstract class DeviceCapabilitiesAlertEntity with _$DeviceCapabilitiesAlertEntity{
  const factory DeviceCapabilitiesAlertEntity({
    required bool enabled,
    required List<String> types,
  }) = _DeviceCapabilitiesAlertEntity;
}

@freezed
abstract class DeviceCapabilitiesContactsEntity with _$DeviceCapabilitiesContactsEntity{
  const factory DeviceCapabilitiesContactsEntity({
    required bool enabled,
    required List<DeviceCapabilitiesContactTypeEntity> types,
  }) = _DeviceCapabilitiesContactsEntity;
}

@freezed
abstract class DeviceCapabilitiesContactTypeEntity with _$DeviceCapabilitiesContactTypeEntity{
  const factory DeviceCapabilitiesContactTypeEntity({
    required String type,
    required int amount,
  }) = _DeviceCapabilitiesContactTypeEntity;
}

@freezed
abstract class DeviceCapabilitiesCommandsEntity with _$DeviceCapabilitiesCommandsEntity{
  const factory DeviceCapabilitiesCommandsEntity({
    required bool enabled,
    required List<String> types,
  }) = _DeviceCapabilitiesCommandsEntity;
}

@freezed
abstract class DeviceCapabilitiesSettingsEntity with _$DeviceCapabilitiesSettingsEntity{
  const factory DeviceCapabilitiesSettingsEntity({
    required bool locationFrequency,
    required bool timezone,
    required bool language,
  }) = _DeviceCapabilitiesSettingsEntity;
}