import 'package:core_localization/core_localization.dart';
import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart';
import 'package:flutter_modular/flutter_modular.dart';
import 'package:krow_domain/krow_domain.dart';

import 'package:krow_core/core.dart';

class RecommendedShiftCard extends StatelessWidget {
  final Shift shift;

  const RecommendedShiftCard({super.key, required this.shift});

  @override
  Widget build(BuildContext context) {
    final recI18n = t.staff.home.recommended_card;

    return GestureDetector(
      onTap: () {
        Modular.to.pushShiftDetails(shift);
      },
      child: Container(
        width: 300,
        padding: const EdgeInsets.all(UiConstants.space4),
        decoration: BoxDecoration(
          color: UiColors.white,
          borderRadius: BorderRadius.circular(UiConstants.radiusBase),
          border: Border.all(color: UiColors.border),
          boxShadow: [
            BoxShadow(
              color: UiColors.black.withValues(alpha: 0.02),
              blurRadius: 4,
              offset: const Offset(0, 2),
            ),
          ],
        ),
        child: SingleChildScrollView(
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            mainAxisSize: MainAxisSize.min,
            children: [
              Row(
                children: [
                  Text(
                    recI18n.act_now,
                    style: UiTypography.body3m.copyWith(color: UiColors.textError),
                  ),
                  const SizedBox(width: UiConstants.space2),
                  Container(
                    padding: const EdgeInsets.symmetric(
                      horizontal: UiConstants.space2,
                      vertical: 2,
                    ),
                    decoration: BoxDecoration(
                      color: UiColors.tagInProgress,
                      borderRadius: UiConstants.radiusFull,
                    ),
                    child: Text(
                      recI18n.one_day,
                      style: UiTypography.body3m.textPrimary,
                    ),
                  ),
                ],
              ),
              const SizedBox(height: UiConstants.space3),
              Row(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Container(
                    width: UiConstants.space10,
                    height: UiConstants.space10,
                    decoration: BoxDecoration(
                      color: UiColors.tagInProgress,
                      borderRadius: BorderRadius.circular(UiConstants.radiusBase),
                    ),
                    child: const Icon(
                      UiIcons.calendar,
                      color: UiColors.primary,
                      size: UiConstants.space5,
                    ),
                  ),
                  const SizedBox(width: UiConstants.space3),
                  Expanded(
                    child: Column(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: [
                        Row(
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          children: [
                            Flexible(
                              child: Text(
                                shift.title,
                                style: UiTypography.body1m.textPrimary,
                                overflow: TextOverflow.ellipsis,
                              ),
                            ),
                            Text(
                              '\$${shift.hourlyRate}/h',
                              style: UiTypography.headline4m.textPrimary,
                            ),
                          ],
                        ),
                        const SizedBox(height: 2),
                        Row(
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          children: [
                            Text(
                              shift.clientName,
                              style: UiTypography.body3r.textSecondary,
                            ),
                            Text(
                              '\$${shift.hourlyRate.toStringAsFixed(0)}/hr',
                              style: UiTypography.body3r.textSecondary,
                            ),
                          ],
                        ),
                      ],
                    ),
                  ),
                ],
              ),
              const SizedBox(height: UiConstants.space3),
              Row(
                children: [
                  const Icon(
                    UiIcons.calendar,
                    size: UiConstants.space3,
                    color: UiColors.mutedForeground,
                  ),
                  const SizedBox(width: UiConstants.space1),
                  Text(
                    recI18n.today,
                    style: UiTypography.body3r.textSecondary,
                  ),
                  const SizedBox(width: UiConstants.space3),
                  const Icon(
                    UiIcons.clock,
                    size: UiConstants.space3,
                    color: UiColors.mutedForeground,
                  ),
                  const SizedBox(width: UiConstants.space1),
                  Text(
                    recI18n.time_range(
                      start: shift.startTime,
                      end: shift.endTime,
                    ),
                    style: UiTypography.body3r.textSecondary,
                  ),
                ],
              ),
              const SizedBox(height: UiConstants.space1),
              Row(
                children: [
                  const Icon(
                    UiIcons.mapPin,
                    size: UiConstants.space3,
                    color: UiColors.mutedForeground,
                  ),
                  const SizedBox(width: UiConstants.space1),
                  Expanded(
                    child: Text(
                      shift.locationAddress,
                      style: UiTypography.body3r.textSecondary,
                      maxLines: 1,
                      overflow: TextOverflow.ellipsis,
                    ),
                  ),
                ],
              ),
            ],
          ),
        ),
      ),
    );
  }
}
