import 'package:hive/hive.dart';

part 'metadata.g.dart';

@HiveType(typeId: 15)
class Metadata extends HiveObject {
  @HiveField(0)
  final DateTime createdAt;

  @HiveField(1)
  final DateTime? updatedAt;

  @HiveField(2)
  final String appType; // "sake", "wine", "beer"

  @HiveField(3)
  final String appMode; // "consumer", "business"

  @HiveField(4)
  final String version;

  @HiveField(5)
  final int? aiConfidence; // Previously confidenceScore

  Metadata({
    required this.createdAt,
    this.updatedAt,
    this.appType = 'sake',
    this.appMode = 'consumer',
    this.version = '1.0',
    this.aiConfidence,
  });

  Metadata copyWith({
    DateTime? createdAt,
    DateTime? updatedAt,
    String? appType,
    String? appMode,
    String? version,
    int? aiConfidence,
  }) {
    return Metadata(
      createdAt: createdAt ?? this.createdAt,
      updatedAt: updatedAt ?? this.updatedAt,
      appType: appType ?? this.appType,
      appMode: appMode ?? this.appMode,
      version: version ?? this.version,
      aiConfidence: aiConfidence ?? this.aiConfidence,
    );
  }
}
