using ErsatzTV.Application.Emby; using ErsatzTV.Application.Jellyfin; using ErsatzTV.Application.Plex; namespace ErsatzTV.Controllers.Api.Requests; // Shared by Plex/Jellyfin/Emby (design #202 §C4a) — the PUT body is the complete set of the // source's libraries; a row absent from the request is left untouched, not deleted. The controller // validates the id set against that source's known libraries before dispatch. public record ReplaceRemoteLibraryPreferencesRequest(List Libraries) { public UpdatePlexLibraryPreferences ToPlexCommand() => new( (Libraries ?? []) .Select(item => new PlexLibraryPreference(item.Id, item.ShouldSyncItems)) .ToList()); public UpdateJellyfinLibraryPreferences ToJellyfinCommand() => new( (Libraries ?? []) .Select(item => new JellyfinLibraryPreference(item.Id, item.ShouldSyncItems)) .ToList()); public UpdateEmbyLibraryPreferences ToEmbyCommand() => new( (Libraries ?? []) .Select(item => new EmbyLibraryPreference(item.Id, item.ShouldSyncItems)) .ToList()); }