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,
        spacing: 24.h,
        children: [
          Row(
            children: [
              Container(
                width: 64.w,
                height: 53.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),
              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),
                ),
              ),
            ],
          ),
          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(229, 241, 255, 1.0),
                  borderRadius: BorderRadius.circular(24.r),
                ),
                child: Row(
                  mainAxisSize: MainAxisSize.min,
                  spacing: 4.w,
                  children: [
                    Icon(
                      Icons.check,
                      color: const Color.fromRGBO(26, 188, 156, 1.0),
                      size: 20.sp,
                    ),
                    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正常';
    }
  }
}
