import 'package:plezy/media/media_backend.dart';
import 'package:plezy/media/media_item.dart';
import 'package:plezy/media/media_kind.dart';
import 'package:plezy/media/media_role.dart';
import 'package:plezy/media/media_version.dart';

/// Canonical backend-neutral [MediaItem] fixture.
///
/// Tests should override only fields relevant to the behavior under test. The
/// defaults deliberately form a valid Plex movie without inventing hierarchy,
/// watch-state, or library metadata that could influence derived getters.
MediaItem testMediaItem({
  String id = 'item-1',
  MediaBackend backend = MediaBackend.plex,
  MediaKind kind = MediaKind.movie,
  String? guid,
  String? title,
  String? titleSort,
  String? summary,
  String? tagline,
  String? originalTitle,
  String? studio,
  int? year,
  String? originallyAvailableAt,
  String? contentRating,
  String? parentId,
  String? parentTitle,
  String? parentThumbPath,
  int? parentIndex,
  int? index,
  String? grandparentId,
  String? grandparentTitle,
  String? grandparentThumbPath,
  String? grandparentArtPath,
  List<String>? grandparentBackdropPaths,
  String? thumbPath,
  String? artPath,
  List<String>? backdropPaths,
  String? clearLogoPath,
  String? backgroundSquarePath,
  int? durationMs,
  int? viewOffsetMs,
  int? viewCount,
  int? lastViewedAt,
  int? leafCount,
  int? viewedLeafCount,
  int? childCount,
  int? addedAt,
  int? updatedAt,
  double? rating,
  double? userRating,
  bool? isFavorite,
  List<String>? genres,
  List<String>? directors,
  List<String>? writers,
  List<String>? producers,
  List<String>? countries,
  List<String>? collections,
  List<String>? labels,
  List<String>? styles,
  List<String>? moods,
  List<MediaRole>? roles,
  List<MediaVersion>? mediaVersions,
  String? libraryId,
  String? libraryTitle,
  String? audioLanguage,
  String? subtitleLanguage,
  int? subtitleMode,
  String? serverId,
  String? serverName,
  String? backendFolderKey,
  Map<String, Object?>? raw,
}) {
  return MediaItem(
    id: id,
    backend: backend,
    kind: kind,
    guid: guid,
    title: title,
    titleSort: titleSort,
    summary: summary,
    tagline: tagline,
    originalTitle: originalTitle,
    studio: studio,
    year: year,
    originallyAvailableAt: originallyAvailableAt,
    contentRating: contentRating,
    parentId: parentId,
    parentTitle: parentTitle,
    parentThumbPath: parentThumbPath,
    parentIndex: parentIndex,
    index: index,
    grandparentId: grandparentId,
    grandparentTitle: grandparentTitle,
    grandparentThumbPath: grandparentThumbPath,
    grandparentArtPath: grandparentArtPath,
    grandparentBackdropPaths: grandparentBackdropPaths,
    thumbPath: thumbPath,
    artPath: artPath,
    backdropPaths: backdropPaths,
    clearLogoPath: clearLogoPath,
    backgroundSquarePath: backgroundSquarePath,
    durationMs: durationMs,
    viewOffsetMs: viewOffsetMs,
    viewCount: viewCount,
    lastViewedAt: lastViewedAt,
    leafCount: leafCount,
    viewedLeafCount: viewedLeafCount,
    childCount: childCount,
    addedAt: addedAt,
    updatedAt: updatedAt,
    rating: rating,
    userRating: userRating,
    isFavorite: isFavorite,
    genres: genres,
    directors: directors,
    writers: writers,
    producers: producers,
    countries: countries,
    collections: collections,
    labels: labels,
    styles: styles,
    moods: moods,
    roles: roles,
    mediaVersions: mediaVersions,
    libraryId: libraryId,
    libraryTitle: libraryTitle,
    audioLanguage: audioLanguage,
    subtitleLanguage: subtitleLanguage,
    subtitleMode: subtitleMode,
    serverId: serverId,
    serverName: serverName,
    backendFolderKey: backendFolderKey,
    raw: raw,
  );
}
