import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';

enum DeviceStatusTab { total, on, off, offline, alarm, fault }

class InspectionDevice {
  final String id;
  final IconData icon;
  final String name;
  final String type;
  final String location;
  final String status;
  final String time;
  final Color statusColor;

  const InspectionDevice({
    required this.id,
    required this.icon,
    required this.name,
    required this.type,
    required this.location,
    required this.status,
    required this.time,
    required this.statusColor,
  });
}

class InspectionState extends Equatable {
  final DeviceStatusTab selectedTab;
  final List<String> selectedRooms;
  final List<InspectionDevice> deviceList;
  final Map<DeviceStatusTab, int> tabCounts;

  const InspectionState({
    this.selectedTab = DeviceStatusTab.total,
    this.selectedRooms = const ['101'],
    this.deviceList = const [],
    this.tabCounts = const {
      DeviceStatusTab.total: 11,
      DeviceStatusTab.on: 7,
      DeviceStatusTab.off: 2,
      DeviceStatusTab.offline: 1,
      DeviceStatusTab.alarm: 1,
      DeviceStatusTab.fault: 0,
    },
  });

  InspectionState copyWith({
    DeviceStatusTab? selectedTab,
    List<String>? selectedRooms,
    List<InspectionDevice>? deviceList,
    Map<DeviceStatusTab, int>? tabCounts,
  }) {
    return InspectionState(
      selectedTab: selectedTab ?? this.selectedTab,
      selectedRooms: selectedRooms ?? this.selectedRooms,
      deviceList: deviceList ?? this.deviceList,
      tabCounts: tabCounts ?? this.tabCounts,
    );
  }

  @override
  List<Object?> get props => [
        selectedTab,
        selectedRooms,
        deviceList,
        tabCounts,
      ];
}
