import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:gap/gap.dart';
import 'package:krow/core/presentation/styles/kw_text_styles.dart';
import 'package:krow/core/presentation/styles/theme.dart';
import 'package:krow/features/earning/domain/entities/earning_shift_entity.dart';
import 'package:krow/features/earning/presentation/widget/list_item/shift_status_label_widget.dart';

class ShiftItemHeaderWidget extends StatelessWidget {
  final EarningShiftEntity viewModel;

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

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.symmetric(horizontal: 20),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              ClipOval(
                child: CachedNetworkImage(
                  imageUrl: viewModel.businessImageUrl,
                  fit: BoxFit.cover,
                  height: 48,
                  width: 48,
                ),
              ),
              EarnedShiftStatusLabelWidget(viewModel),
            ],
          ),
          const Gap(12),
          Row(
            children: [
              Expanded(
                child: Text(
                  viewModel.skillName,
                  style: AppTextStyles.bodyMediumMed,
                ),
              ),
              const Gap(24),
              Text(
                '\$${viewModel.earned}',
                style: AppTextStyles.bodyMediumMed,
              )
            ],
          ),
          const Gap(4),
          Text(
            viewModel.businessName,
            style: AppTextStyles.bodySmallReg.copyWith(
              color: AppColors.blackGray,
            ),
          ),
        ],
      ),
    );
  }
}
