import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:gap/gap.dart';
import 'package:intl/intl.dart';
import 'package:krow/core/presentation/styles/kw_box_decorations.dart';
import 'package:krow/core/presentation/styles/kw_text_styles.dart';
import 'package:krow/core/presentation/styles/theme.dart';
import 'package:krow/features/shifts/domain/shift_entity.dart';

class ShiftInfoClockTimeWidget extends StatelessWidget {
  final ShiftEntity viewModel;

  const ShiftInfoClockTimeWidget({super.key, required this.viewModel});

  @override
  Widget build(BuildContext context) {
    var clockIn = DateFormat('h:mma','en')
        .format(viewModel.clockIn ?? DateTime.now())
        .toLowerCase();
    var clockOut = DateFormat('h:mma','en')
        .format(viewModel.clockOut ?? DateTime.now())
        .toLowerCase();

    return Expanded(
      child: Container(
        padding: const EdgeInsets.all(12),
        decoration: KwBoxDecorations.primaryLight12,
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Text('${'clock_in_1'.tr()} - ${'clock_out_1'.tr()}'.toUpperCase(),
                style: AppTextStyles.captionReg
                    .copyWith(color: AppColors.blackCaptionText)),
            const Gap(16),
            Text(clockIn, style: AppTextStyles.headingH3),
            const Gap(6),
            Text('clock_in_1'.tr(),
                style: AppTextStyles.bodySmallReg
                    .copyWith(color: AppColors.blackGray)),
            const Gap(12),
            Text(clockOut, style: AppTextStyles.headingH3),
            const Gap(6),
            Text('clock_out_1'.tr(),
                style: AppTextStyles.bodySmallReg
                    .copyWith(color: AppColors.blackGray)),
          ],
        ),
      ),
    );
  }
}
