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/shifts/domain/shift_entity.dart';
import 'package:krow/features/shifts/presentation/widgets/shift_item_components/shift_status_label_widget.dart';

class ShiftItemHeaderWidget extends StatelessWidget {
  final ShiftEntity 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: [
              viewModel.imageUrl.isNotEmpty
                  ? ClipOval(
                      child: CachedNetworkImage(
                      imageUrl: viewModel.imageUrl,
                      fit: BoxFit.cover,
                      height: 48,
                      width: 48,
                    ))
                  : const SizedBox.shrink(),
              ShiftStatusLabelWidget(viewModel),
            ],
          ),
          const Gap(12),
          Row(
            children: [
              Expanded(
                  child: Text(
                viewModel.skillName,
                style: AppTextStyles.bodyMediumMed,
              )),
              const Gap(24),
              Text(
                '\$${viewModel.rate}/h',
                style: AppTextStyles.bodyMediumMed,
              )
            ],
          ),
          const Gap(4),
          Text(
            viewModel.eventName,
            style:
                AppTextStyles.bodySmallReg.copyWith(color: AppColors.blackGray),
          ),
        ],
      ),
    );
  }
}
