import 'package:flutter/foundation.dart';
import 'package:krow/features/profile/benefits/domain/entities/benefit_record_entity.dart';

@immutable
class BenefitEntity {
  const BenefitEntity({
    required this.name,
    required this.requirement,
    required this.requiredHours,
    required this.currentHours,
    required this.isClaimed,
    required this.info,
    required this.history,
  });

  final String name;
  final String requirement;
  final int requiredHours;
  final int currentHours;
  final bool isClaimed;
  final String info;
  final List<BenefitRecordEntity> history;

  double get progress {
    final progress = currentHours / requiredHours;
    return progress > 1 ? 1 : progress;
  }

  BenefitEntity copyWith({
    String? name,
    String? requirement,
    int? requiredHours,
    int? currentHours,
    bool? isClaimed,
    String? info,
    List<BenefitRecordEntity>? history,
  }) {
    return BenefitEntity(
      name: name ?? this.name,
      requirement: requirement ?? this.requirement,
      requiredHours: requiredHours ?? this.requiredHours,
      currentHours: currentHours ?? this.currentHours,
      isClaimed: isClaimed ?? this.isClaimed,
      info: info ?? this.info,
      history: history ?? this.history,
    );
  }
}
