import 'package:json_annotation/json_annotation.dart';

/// Created by Haoyi on 2023/1/25

part 'vibrate_model.g.dart';

class VibrationState {
  static const off = 0;
  static const on = 1;
}

@JsonSerializable()
class VibrateEffect {
  @JsonKey(name: "pattern", defaultValue: <int>[])
  final List<int> pattern;

  @JsonKey(name: "intensities", defaultValue: <int>[])
  final List<int> intensities;

  @JsonKey(name: "amplitude", defaultValue: -1)
  final int amplitude;

  @JsonKey(name: "amplitude_duration", defaultValue: 500)
  final int amplitudeDuration;

  @JsonKey(name: "duration", defaultValue: 500)
  final int duration;

  VibrateEffect(
      this.pattern, this.intensities, this.amplitude, this.amplitudeDuration, this.duration);

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

  @override
  String toString() {
    return 'VibrateEffect{pattern: $pattern, intensities: $intensities, amplitude: $amplitude, duration: $duration}';
  }

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