import 'package:hive/hive.dart';

part 'sake_taste_stats.g.dart';

@HiveType(typeId: 21) // Ensure ID 21 is free or managed
class SakeTasteStats extends HiveObject {
  @HiveField(0)
  final double aroma; // 香り

  @HiveField(1)
  final double richness; // コク

  @HiveField(2)
  final double sweetness; // 甘み

  @HiveField(3)
  final double alcoholFeeling; // アルコール感 (キレ)

  @HiveField(4)
  final double fruitiness; // フルーティさ

  SakeTasteStats({
    required this.aroma,
    required this.richness,
    required this.sweetness,
    required this.alcoholFeeling,
    required this.fruitiness,
  });
  
  // Factory to convert from Map (legacy/current HiddenSpecs format)
  factory SakeTasteStats.fromMap(Map<String, int> map) {
    return SakeTasteStats(
      aroma: (map['aroma'] ?? 0).toDouble(),
      richness: (map['richness'] ?? 0).toDouble(),
      sweetness: (map['sweetness'] ?? 0).toDouble(),
      alcoholFeeling: (map['alcohol'] ?? 0).toDouble(),
      fruitiness: (map['fruitiness'] ?? 0).toDouble(),
    );
  }
}
