/// Represents a media server configuration. class MediaServerConfig { /// Unique identifier for this server configuration. final String id; /// Server type: 'immich' or 'blossom'. final String type; /// Base URL for the server. final String baseUrl; /// API key (for Immich only). final String? apiKey; /// Whether this is the default server. final bool isDefault; /// Display name for this server (optional). final String? name; /// Creates a [MediaServerConfig]. MediaServerConfig({ required this.id, required this.type, required this.baseUrl, this.apiKey, this.isDefault = false, this.name, }); /// Creates a [MediaServerConfig] from a JSON map. factory MediaServerConfig.fromJson(Map json) { return MediaServerConfig( id: json['id'] as String, type: json['type'] as String, baseUrl: json['baseUrl'] as String, apiKey: json['apiKey'] as String?, isDefault: json['isDefault'] as bool? ?? false, name: json['name'] as String?, ); } /// Converts [MediaServerConfig] to JSON. Map toJson() { return { 'id': id, 'type': type, 'baseUrl': baseUrl, 'apiKey': apiKey, 'isDefault': isDefault, 'name': name, }; } /// Creates a copy with updated fields. MediaServerConfig copyWith({ String? id, String? type, String? baseUrl, String? apiKey, bool? isDefault, String? name, }) { return MediaServerConfig( id: id ?? this.id, type: type ?? this.type, baseUrl: baseUrl ?? this.baseUrl, apiKey: apiKey ?? this.apiKey, isDefault: isDefault ?? this.isDefault, name: name ?? this.name, ); } @override String toString() { return 'MediaServerConfig(id: $id, type: $type, baseUrl: $baseUrl, isDefault: $isDefault)'; } }