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

class InspectionHistoryState extends Equatable {
  final String deviceId;
  final int totalCount;
  final int passCount;
  final int warningCount;
  final int failCount;
  final List<InspectionRecord> records;

  const InspectionHistoryState({
    required this.deviceId,
    required this.totalCount,
    required this.passCount,
    required this.warningCount,
    required this.failCount,
    required this.records,
  });

  InspectionHistoryState copyWith({
    String? deviceId,
    int? totalCount,
    int? passCount,
    int? warningCount,
    int? failCount,
    List<InspectionRecord>? records,
  }) {
    return InspectionHistoryState(
      deviceId: deviceId ?? this.deviceId,
      totalCount: totalCount ?? this.totalCount,
      passCount: passCount ?? this.passCount,
      warningCount: warningCount ?? this.warningCount,
      failCount: failCount ?? this.failCount,
      records: records ?? this.records,
    );
  }

  @override
  List<Object?> get props => [
        deviceId,
        totalCount,
        passCount,
        warningCount,
        failCount,
        records,
      ];
}

class InspectionRecord extends Equatable {
  final String deviceName;
  final String inspectorName;
  final String inspectionTime;
  final String result;
  final String remark;
  final List<InspectionItemRecord> items;
  final IconData icon;

  const InspectionRecord({
    required this.deviceName,
    required this.inspectorName,
    required this.inspectionTime,
    required this.result,
    required this.remark,
    required this.items,
    required this.icon,
  });

  @override
  List<Object?> get props => [
        deviceName,
        inspectorName,
        inspectionTime,
        result,
        remark,
        items,
        icon,
      ];
}

class InspectionItemRecord extends Equatable {
  final String name;
  final String result;

  const InspectionItemRecord({
    required this.name,
    required this.result,
  });

  @override
  List<Object?> get props => [name, result];
}
