import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:smart_hotel_app/views/service/room/cubit/service_room_state.dart';

class RoomOverviewCard extends StatelessWidget {
  final String roomNumber;
  final String roomStatus;
  final List<RoomStatusTag> statusTags;

  const RoomOverviewCard({
    super.key,
    required this.roomNumber,
    required this.roomStatus,
    required this.statusTags,
  });

  @override
  Widget build(BuildContext context) {
    return Container(
      decoration: BoxDecoration(
        color: Colors.white,
        borderRadius: BorderRadius.circular(24.r),
      ),
      padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 24.h),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Row(
            children: [
              Container(
                width: 88.w,
                height: 88.h,
                decoration: BoxDecoration(
                  color: const Color.fromRGBO(235, 244, 255, 1.0),
                  borderRadius: BorderRadius.circular(16.r),
                ),
                child: Icon(
                  Icons.bed_outlined,
                  color: const Color.fromRGBO(66, 165, 245, 1.0),
                  size: 48.sp,
                ),
              ),
              SizedBox(width: 20.w),
              Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Row(
                    children: [
                      Text(
                        roomNumber,
                        style: TextStyle(
                          fontSize: 36.sp,
                          fontWeight: FontWeight.bold,
                          color: const Color.fromRGBO(10, 13, 20, 1.0),
                        ),
                      ),
                      SizedBox(width: 12.w),
                      Text(
                        roomStatus,
                        style: TextStyle(
                          fontSize: 28.sp,
                          color: const Color.fromRGBO(66, 165, 245, 1.0),
                        ),
                      ),
                    ],
                  ),
                ],
              ),
            ],
          ),
          SizedBox(height: 24.h),
          Wrap(
            spacing: 8.w,
            children: statusTags.map((tag) {
              return Container(
                padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 8.h),
                decoration: BoxDecoration(
                  color: const Color.fromRGBO(225, 245, 238, 1.0),
                  borderRadius: BorderRadius.circular(12.r),
                ),
                child: Row(
                  mainAxisSize: MainAxisSize.min,
                  children: [
                    Icon(
                      Icons.check,
                      color: const Color.fromRGBO(26, 188, 156, 1.0),
                      size: 20.sp,
                    ),
                    SizedBox(width: 4.w),
                    Text(
                      _getTagLabel(tag),
                      style: TextStyle(
                        fontSize: 24.sp,
                        color: const Color.fromRGBO(26, 188, 156, 1.0),
                      ),
                    ),
                  ],
                ),
              );
            }).toList(),
          ),
        ],
      ),
    );
  }

  String _getTagLabel(RoomStatusTag tag) {
    switch (tag) {
      case RoomStatusTag.hasPerson:
        return '有人';
      case RoomStatusTag.powerOn:
        return '通电中';
      case RoomStatusTag.wifiNormal:
        return 'wifi正常';
    }
  }
}
