import 'package:flutter/material.dart';
import 'package:krow/core/presentation/styles/kw_box_decorations.dart';
import 'package:krow/core/presentation/widgets/shift_payment_step_widget.dart';
import 'package:krow/core/presentation/widgets/shift_total_time_spend_widget.dart';
import 'package:krow/features/earning/domain/entities/earning_shift_entity.dart';
import 'package:krow/features/earning/presentation/widget/list_item/earning_action_widget.dart';
import 'package:krow/features/earning/presentation/widget/list_item/shift_item_header_widget.dart';

class EarningCardWidget extends StatelessWidget {
  const EarningCardWidget({
    super.key,
    required this.earningEntity,
  });

  final EarningShiftEntity earningEntity;

  @override
  Widget build(BuildContext context) {
    return Container(
      decoration: KwBoxDecorations.primaryLight12,
      padding: const EdgeInsets.only(top: 24, bottom: 24),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          ShiftItemHeaderWidget(earningEntity),
          ShiftTotalTimeSpendWidget(
            startTime: earningEntity.clockIn!,
            endTime: earningEntity.clockOut!,
            totalBreakTime: earningEntity.totalBreakTime ?? 0,
          ),
          ShiftPaymentStepWidget(
            currentIndex: earningEntity.paymentProgressStep,
          ),
          if (earningEntity.status == EarningStatus.confirmedByAdmin)
            EarningActionWidget(earningShiftEntity: earningEntity),
        ],
      ),
    );
  }
}
