import 'ble_status.dart';
import 'player_status.dart';
import 'wifi_status.dart';

class DeviceStatus {
  const DeviceStatus({
    required this.connected,
    required this.connectionType,
    this.deviceName,
    this.ipAddress,
    this.playerStatus,
    this.wifiStatus,
    this.bleStatus,
    this.updatedAt,
  });

  final bool connected;
  final String connectionType;
  final String? deviceName;
  final String? ipAddress;
  final PlayerStatus? playerStatus;
  final WifiStatus? wifiStatus;
  final BleServiceStatus? bleStatus;
  final DateTime? updatedAt;

  factory DeviceStatus.initial() {
    return const DeviceStatus(
      connected: false,
      connectionType: 'offline',
    );
  }

  DeviceStatus copyWith({
    bool? connected,
    String? connectionType,
    String? deviceName,
    String? ipAddress,
    PlayerStatus? playerStatus,
    WifiStatus? wifiStatus,
    BleServiceStatus? bleStatus,
    DateTime? updatedAt,
  }) {
    return DeviceStatus(
      connected: connected ?? this.connected,
      connectionType: connectionType ?? this.connectionType,
      deviceName: deviceName ?? this.deviceName,
      ipAddress: ipAddress ?? this.ipAddress,
      playerStatus: playerStatus ?? this.playerStatus,
      wifiStatus: wifiStatus ?? this.wifiStatus,
      bleStatus: bleStatus ?? this.bleStatus,
      updatedAt: updatedAt ?? this.updatedAt,
    );
  }
}
